|
Using the BackgroundWorker, it is very easy to do. The main thing to be aware if that you should call ReportProgress at an appropriate rate to have a balance between progress bar updating and actual processing. As a starting point, you might report the progress each time the percentage is increased by 1.
Philippe Mori
|
|
|
|
|
i want to create a wind or rain effect in c#
|
|
|
|
|
In what? A still image? An XNA scene? DirectX? OpenGL? A small house just outside of Phnom Penh?
|
|
|
|
|
in still images like apply effect on picture box
|
|
|
|
|
It's obvious. Open Windows.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Peter_in_2780 wrote: Open Windows.
Yeah, but that's always such a pane!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You have two choices that I can see. One is to hand code the Paint routine to modify the image in a sequence that simulates rain falling, pixel-by-pixel. Or you can use a tool like photoshop to create a sequence of changed images, then save them in an animated .gif format. There may be other, better formats for animations than .gif, but I don't know of any that don't require a separate viewer. Try using Google to search for animation formats, and keep in mind that some will require that your user have some display tool installed to view some of them. Try to avoid that, if you can.
If that doesn't pan out, you can still go through the tedious task of sequencing hand-coded bitmaps using the Paint routine. Personally, I'd rather have a root canal, but tastes vary...
Will Rogers never met me.
|
|
|
|
|
thanks for your help..
but can you please to help me to find a small demo .. for starting this task ..
|
|
|
|
|
The BBC Radiophonic Workshop would have been able to help, but they shut it down years ago.
|
|
|
|
|
Hi there i want to create node to make the Half man Tree The code that i found to make node is here
<pre lang="c#">
public class Node
{
public char Symbol { get; set; }
public int Frequency { get; set; }
public Node Right { get; set; }
public Node Left { get; set; }
public List<bool> Traverse(char symbol, List<bool> data)
{
// Leaf
if (Right == null && Left == null)
{
if (symbol.Equals(this.Symbol))
{
return data;
}
else
{
return null;
}
}
else
{
List<bool> left = null;
List<bool> right = null;
if (Left != null)
{
List<bool> leftPath = new List<bool>();
leftPath.AddRange(data);
leftPath.Add(false);
left = Left.Traverse(symbol, leftPath);
}
if (Right != null)
{
List<bool> rightPath = new List<bool>();
rightPath.AddRange(data);
rightPath.Add(true);
right = Right.Traverse(symbol, rightPath);
}
if (left != null)
{
return left;
}
else
{
return right;
}
}
}
}
</pre>
I know that the Symbol and Frequency Are the data and the Left and Right is to store the position of the another Node. but i dont understand the Traverse Method. what is for!!!
The Rest of the halff man code is here:
<pre lang="c#">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace HuffmanTest
{
public class HuffmanTree
{
private List<Node> nodes = new List<Node>();
public Node Root { get; set; }
public Dictionary<char, int> Frequencies = new Dictionary<char, int>();
public void Build(string source)
{
for (int i = 0; i < source.Length; i++)
{
if (!Frequencies.ContainsKey(source[i]))
{
Frequencies.Add(source[i], 0);
}
Frequencies[source[i]]++;
}
foreach (KeyValuePair<char, int> symbol in Frequencies)
{
nodes.Add(new Node() { Symbol = symbol.Key, Frequency = symbol.Value });
}
while (nodes.Count > 1)
{
List<Node> orderedNodes = nodes.OrderBy(node => node.Frequency).ToList<Node>();
if (orderedNodes.Count >= 2)
{
// Take first two items
List<Node> taken = orderedNodes.Take(2).ToList<Node>();
// Create a parent node by combining the frequencies
Node parent = new Node()
{
Symbol = '*',
Frequency = taken[0].Frequency + taken[1].Frequency,
Left = taken[0],
Right = taken[1]
};
nodes.Remove(taken[0]);
nodes.Remove(taken[1]);
nodes.Add(parent);
}
this.Root = nodes.FirstOrDefault();
}
}
public BitArray Encode(string source)
{
List<bool> encodedSource = new List<bool>();
for (int i = 0; i < source.Length; i++)
{
List<bool> encodedSymbol = this.Root.Traverse(source[i], new List<bool>());
encodedSource.AddRange(encodedSymbol);
}
BitArray bits = new BitArray(encodedSource.ToArray());
return bits;
}
public string Decode(BitArray bits)
{
Node current = this.Root;
string decoded = "";
foreach (bool bit in bits)
{
if (bit)
{
if (current.Right != null)
{
current = current.Right;
}
}
else
{
if (current.Left != null)
{
current = current.Left;
}
}
if (IsLeaf(current))
{
decoded += current.Symbol;
current = this.Root;
}
}
return decoded;
}
public bool IsLeaf(Node node)
{
return (node.Left == null && node.Right == null);
}
}
}
</pre>
|
|
|
|
|
Did you get this to work for you yet? By the way, it's called Huffman Tree
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have a question about the benefits of using linq to sql in a C# 2010 web application. I am asking that question since I am the only programmer at a small company that is making changes to the company website that was written originally by a contract shop that went out of business. This is the first time I have worked with linq to sql.
From my point of view, I just see linq as more performance overhead to slow down the performance of the website. The linq needs to be translated to sql by the .net application. Thus can you tell me what I am missing?
|
|
|
|
|
In a lot of cases, a well designed LINQ application is no less performant than a hand crafted SQL solution. You have to be aware of what you are doing, but when you do know, it's a pretty powerful technique.
|
|
|
|
|
Neh. The peformance is similar to hand rolling the code against SQL directly, but (as Pete has said) you need to know what you are doing. You can use SQL Queries, with LINQ to SQL, and the queries can be optimised in the usual way.
What is does bring in the ability not to need write yet another DAL Implementation, freeing you up to be more productive in other areas. I've not really used ADO.NET directly for a good few years now, nor have I felt the need to.
|
|
|
|
|
Hi,
If you can utilize LINQ perfectly then linq to sql will definitely improve your application performance. One more advantage is database dependency. you can provide multiple database support for your application like MySQL, MsSQL, etc....
You do not need to maintain two database query individually. Framework will manage that.
There are more features and both way have pros and cons. so you need to decide it from your application requirements.
Thanks
-amit
|
|
|
|
|
amitgajjar wrote: If you can utilize LINQ perfectly then linq to sql will definitely
improve your application performance.
Bold statement there. It MAY improve application performance, but if I write equally optimised SQL then I won't see an improvement.
|
|
|
|
|
Yes but my personal opinion is if we are with the latest trend or flow of the Microsoft evolution then we can win the race. As we can see Microsoft people concentrate on new things, so if you are planning for long term project then we should use latest one.
As good coding in Framework 2.0 is better then Bad in Framework 4.0
But i would like to know your personal opinion, if you have a long term project what will be your choice ?
-Amit
|
|
|
|
|
|
on codeplex it says this project is in progress. so can we rely on that ?
|
|
|
|
|
Yes. The in progress part means we are adding lots of new features to it - this really is an ongoing project. It's actually up and running here[^].
|
|
|
|
|
my project i used tcp server done by c# program and wp7 client tcp
i want ask if i can used wcf service (to remote DB on server ) with tcp in the same project ??????????????????????
|
|
|
|
|
Yeah, why wouldn't you be able to?
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace SSG
{
public partial class frmBusiness_Statement : Form
{
string[,] Plans;
int BranchId = 0;
string branchname = "";
string memberid = "";
int statementid = 0;
double TotalRecieptAmount = 0.0;
public frmBusiness_Statement()
{
InitializeComponent();
}
private void frmBusinessStatement_Load(object sender, EventArgs e)
{
dtpStatementDate.Value = DateTime.Now;
radNewBusiness_CheckedChanged(sender, new EventArgs());
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT CONCAT(branchname,' (',branchcode,')') AS branch FROM branches";
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
cmbBranch.Items.Clear();
if (r.HasRows)
{
while (r.Read())
{
cmbBranch.Items.Add(r.GetString("branch"));
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void radMember_CheckedChanged(object sender, EventArgs e)
{
if (radMember.Checked)
{
lblMCE.Text = "Member ID";
lblMCEN.Text = "Member Name";
txtDesignation.Text = "";
}
else
{
lblMCE.Text = "Executive ID";
lblMCEN.Text = "Executive Name";
txtDesignation.Text = "Collection Executive";
}
}
private void radCE_CheckedChanged(object sender, EventArgs e)
{
radMember_CheckedChanged(sender, new EventArgs());
}
private void cmbBranch_SelectedIndexChanged(object sender, EventArgs e)
{
string branchcode = "";
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT branchid,branchcode,branchname FROM branches WHERE CONCAT(branchname,' (',branchcode,')') LIKE '" + cmbBranch.Text + "'";
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
branchcode = r.GetString("branchcode");
branchname = r.GetString("branchname");
this.BranchId = r.GetInt32("branchid");
if (txtMemberID.Text.Length <= 4)
{
txtMemberID.Text = r.GetString("branchcode");
}
else
{
string prev = "";
prev = txtMemberID.Text.Substring(4);
if (prev.Length < 6)
{
prev = memberid;
}
txtMemberID.Text = r.GetString("branchcode") + prev;
}
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT IFNULL(MAX(statementid),0) AS statementid FROM business_statements";
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
statementid = r.GetInt32("statementid") + 1;
}
lblStatementNo.Text = dtpStatementDate.Value.ToString("MMMyy").ToUpper() + "/" + GlobalVariables.GetFullNumber(statementid, 5) + "/" + branchcode;
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtMemberID_TextChanged(object sender, EventArgs e)
{
if (txtMemberID.Text.Length > 6)
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
/* Have to make change here! */
string qry;
if (radMember.Checked)
{
qry = "SELECT membername,(SELECT designationname FROM designations WHERE designationid=members.designationid) AS designation FROM members WHERE memberid=" + txtMemberID.Text.Substring(5);
}
else
{
qry = "SELECT cename AS membername,'Collection Executive' AS designation FROM collectionexecutives WHERE ceid=" + txtMemberID.Text.Substring(5);
}
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
txtMemberName.Text = r.GetString("membername");
txtDesignation.Text = r.GetString("designation");
}
else
{
txtMemberName.Text = "";
txtDesignation.Text = "";
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void radRenewal_CheckedChanged(object sender, EventArgs e)
{
radNewBusiness_CheckedChanged(sender, new EventArgs());
}
private void fillPlans()
{
cmbPlan.Items.Clear();
cmbPlan.Items.Add("SID");
cmbPlan.Items.Add("RUC");
cmbPlan.Items.Add("PS");
if (radNewBusiness.Checked == true)
{
cmbPlan.Items.Add("FD");
cmbPlan.Items.Add("BBA");
}
}
private void radNewBusiness_CheckedChanged(object sender, EventArgs e)
{
if (radNewBusiness.Checked)
{
radCE.Enabled = false;
radMember.Checked = true;
grpInvestors.Visible = false;
}
else
{
radCE.Enabled = true;
grpInvestors.Visible = true;
}
fillPlans();
}
private void txtCustomerId_TextChanged(object sender, EventArgs e)
{
string branchcode = "";
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT branchid,branchcode,branchname FROM branches WHERE CONCAT(branchname,' (',branchcode,')') LIKE '" + cmbBranch.Text + "'";
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
branchcode = r.GetString("branchcode");
branchname = r.GetString("branchname");
this.BranchId = r.GetInt32("branchid");
}
}
if (cmbPlan.Text == "SID")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT customerid, agreementdate, accountname, refererid, tableno, dateofexpiry FROM investers_sid WHERE investeridsid LIKE '" + txtCustomerId.Text.Trim() + "' AND plan LIKE '" + cmbPlan.Text + "' ";
if (radCE.Checked == true)
{
qry += "AND ceid=" + txtMemberID.Text.Substring(5);
}
else
{
qry += "AND refererid=" + txtMemberID.Text.Substring(5);
}
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
txtIvestorName.Text = r.GetString("accountname");
txtRMemberId.Text = r.GetString("refererid");
txtRAmount.Text = r.GetString("investment");
txtTableNo.Text = r.GetString("tableno");
dtpClosingDate.Value = r.GetDateTime("dateofexpiry");
FillHistory();
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
dgInvestorHistory.DataSource = null;
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
}
if (cmbPlan.Text == "RUC")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT customerid, agreementdate, accountname, refererid, tableno, dateofexpiry FROM investers_ruc WHERE investeridruc LIKE '" + txtCustomerId.Text.Trim() + "' AND plan LIKE '" + cmbPlan.Text + "' ";
if (radCE.Checked == true)
{
qry += "AND ceid=" + txtMemberID.Text.Substring(5);
}
else
{
qry += "AND refererid=" + txtMemberID.Text.Substring(5);
}
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
txtIvestorName.Text = r.GetString("accountname");
txtRMemberId.Text = r.GetString("refererid");
txtRAmount.Text = r.GetString("investment");
txtTableNo.Text = r.GetString("tableno");
dtpClosingDate.Value = r.GetDateTime("dateofexpiry");
FillHistory();
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
dgInvestorHistory.DataSource = null;
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
}
if (cmbPlan.Text == "PS")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT customerid, agreementdate, accountname, refererid, tableno, dateofexpiry FROM investers_ps WHERE investeridps LIKE '" + txtCustomerId.Text.Trim() + "' AND plan LIKE '" + cmbPlan.Text + "' ";
if (radCE.Checked == true)
{
qry += "AND ceid=" + txtMemberID.Text.Substring(5);
}
else
{
qry += "AND refererid=" + txtMemberID.Text.Substring(5);
}
MySqlCommand cmd = new MySqlCommand(qry, con);
MySqlDataReader r = cmd.ExecuteReader();
if (r.HasRows)
{
r.Read();
txtIvestorName.Text = r.GetString("accountname");
txtRMemberId.Text = r.GetString("refererid");
txtRAmount.Text = r.GetString("investment");
txtTableNo.Text = r.GetString("tableno");
dtpClosingDate.Value = r.GetDateTime("dateofexpiry");
FillHistory();
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
dgInvestorHistory.DataSource = null;
}
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
txtIvestorName.Text = "";
txtRMemberId.Text = "";
txtRAmount.Text = "";
txtLateFee.Text = "0";
txtTableNo.Text = "";
dtpClosingDate.Value = DateTime.Now;
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnAddReciept_Click(object sender, EventArgs e)
{
if (cmbPlan.Text == "SID")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "INSERT INTO reciepts_sid (recieptdate,customerid,statementid,amount,latefee,createdat,createdby) VALUES('" + dtpStatementDate.Value.ToString("yyyy-MM-dd") + "'," + txtCustomerId.Text.Trim() + "," + lblStatementNo.Text.Split('/')[1] + "," + txtRAmount.Text.Trim() + "," + txtLateFee.Text.Trim() + ",NOW()," + GlobalVariables.CurrentUserId.ToString() + ")";
MySqlCommand cmd = new MySqlCommand(qry, con);
cmd.ExecuteNonQuery();
TotalRecieptAmount += Convert.ToDouble(txtRAmount.Text.Trim());
FillHistory();
MessageBox.Show("Reciept has been added to [" + txtCustomerId.Text.Trim() + "] successfuly!", "Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtTotalAmount.Text = TotalRecieptAmount.ToString();
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
FillHistory();
}
else if (cmbPlan.Text == "RUC")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "INSERT INTO reciepts_ruc (recieptdate,customerid,statementid,amount,latefee,createdat,createdby) VALUES('" + dtpStatementDate.Value.ToString("yyyy-MM-dd") + "'," + txtCustomerId.Text.Trim() + "," + lblStatementNo.Text.Split('/')[1] + "," + txtRAmount.Text.Trim() + "," + txtLateFee.Text.Trim() + ",NOW()," + GlobalVariables.CurrentUserId.ToString() + ")";
MySqlCommand cmd = new MySqlCommand(qry, con);
cmd.ExecuteNonQuery();
TotalRecieptAmount += Convert.ToDouble(txtRAmount.Text.Trim());
FillHistory();
MessageBox.Show("Reciept has been added to [" + txtCustomerId.Text.Trim() + "] successfuly!", "Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtTotalAmount.Text = TotalRecieptAmount.ToString();
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
FillHistory();
}
if (cmbPlan.Text == "PS")
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "INSERT INTO reciepts_ps (recieptdate,customerid,statementid,amount,latefee,createdat,createdby) VALUES('" + dtpStatementDate.Value.ToString("yyyy-MM-dd") + "'," + txtCustomerId.Text.Trim() + "," + lblStatementNo.Text.Split('/')[1] + "," + txtRAmount.Text.Trim() + "," + txtLateFee.Text.Trim() + ",NOW()," + GlobalVariables.CurrentUserId.ToString() + ")";
MySqlCommand cmd = new MySqlCommand(qry, con);
cmd.ExecuteNonQuery();
TotalRecieptAmount += Convert.ToDouble(txtRAmount.Text.Trim());
FillHistory();
MessageBox.Show("Reciept has been added to [" + txtCustomerId.Text.Trim() + "] successfuly!", "Added", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtTotalAmount.Text = TotalRecieptAmount.ToString();
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
FillHistory();
}
}
private void FillHistory()
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string qry = "SELECT recieptid,recieptdate AS `Date`,amount AS `Amount Paid`, latefee AS `Late Fee(if any)` FROM reciepts WHERE investorid=" + txtCustomerId.Text.Trim();
MySqlDataAdapter adap = new MySqlDataAdapter();
adap.SelectCommand = new MySqlCommand(qry, con);
DataTable tbl = new DataTable();
adap.Fill(tbl);
BindingSource bs = new BindingSource();
bs.DataSource = tbl;
dgInvestorHistory.DataSource = bs;
dgInvestorHistory.Columns[0].Visible = true;
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnSaveStatement_Click(object sender, EventArgs e)
{
try
{
using (MySqlConnection con = new MySqlConnection(GlobalVariables.ConnectionString))
{
con.Open();
string statementType = "1";
if (radNewBusiness.Checked)
{
statementType = "1";
}
else
{
statementType = "2";
}
string member = "";
string ce = "";
if (radMember.Checked)
{
ce = (0).ToString();
member = txtMemberID.Text.Substring(5);
}
else
{
member = (0).ToString();
ce = txtMemberID.Text.Substring(5);
}
string qry = "INSERT INTO business_statements (statementid,statementno,date,branch,memberid,ceid,noofenrollments,totalamount,statementtype,planname,createdat,createdby) VALUES(" + statementid.ToString() + ",'" + lblStatementNo.Text + "','" + dtpStatementDate.Value.ToString("yyyy-MM-dd") + "'," + BranchId.ToString() + "," + member + ",'" + ce + "',0," + txtTotalAmount.Text.Trim() + "," + statementType + ",'" + cmbPlan.Text + "',NOW()," + GlobalVariables.CurrentUserId.ToString() + ")";
MySqlCommand cmd = new MySqlCommand(qry, con);
cmd.ExecuteNonQuery();
MessageBox.Show("Business Statement[" + lblStatementNo.Text + "] has been successfully Created for Marketer:[" + txtMemberName.Text + "]!", "Created!", MessageBoxButtons.OK, MessageBoxIcon.Information);
dtpStatementDate.Value = DateTime.Now;
txtTotalAmount.Text = "";
txtDesignation.Text = "";
txtMemberID.Text = "";
txtMemberName.Text = "";
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
grpInvestors.Visible = false;
dgInvestorHistory.DataSource = null;
this.Close();
}
}
}
|
|
|
|
|
First, you don't call "values", so we have no idea what you're trying to do.
Second, you only post the RELEVENT code snippets, not your entire frickin' project. I'm not in the mood to read that massive amount of code.
|
|
|
|
|
Dave Kreskowiak wrote: post the RELEVENT code snippets, not your entire frickin' project. I'm not in the mood to read that massive amount of code
I second that, as I'm never in the mood to read the irrelevant code.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|