G
Guest
I am using a data window with textbox's. some of the data is money keyed in
as "60.00". I need to convert this to money before I can save it to a sql
data table.
the code is done in C#. can someone help me!!! The specific code is included.
SqlCommand cmdGetIdentity = new SqlCommand();
System.Text.StringBuilder b;
try
{
b = new System.Text.StringBuilder(" ");
b.Append("INSERT INTO services([service-code],
[service-description], [large-animal-cost], [medium-animal-cost],
[small-animal-cost]) values('");
b.Append(txtServiceCode.Text);
b.Append("','");
b.Append(txtDescription.Text);
b.Append("','");
b.Append(cbLargeAnimalCost.Text);
b.Append("','");
b.Append(cbMediumAnimalCost.Text);
b.Append("','");
b.Append(cbSmallAnimalCost.Text);
b.Append("')" );
sqlInsertCommand1.CommandText=b.ToString();
this.sqlConnection1.Open();
sqlInsertCommand1.ExecuteNonQuery();
this.sqlConnection1.Close();
MessageBox.Show("Insert Complete. [services] " + txtServiceNumber.Text +
" Successful.","");
}
as "60.00". I need to convert this to money before I can save it to a sql
data table.
the code is done in C#. can someone help me!!! The specific code is included.
SqlCommand cmdGetIdentity = new SqlCommand();
System.Text.StringBuilder b;
try
{
b = new System.Text.StringBuilder(" ");
b.Append("INSERT INTO services([service-code],
[service-description], [large-animal-cost], [medium-animal-cost],
[small-animal-cost]) values('");
b.Append(txtServiceCode.Text);
b.Append("','");
b.Append(txtDescription.Text);
b.Append("','");
b.Append(cbLargeAnimalCost.Text);
b.Append("','");
b.Append(cbMediumAnimalCost.Text);
b.Append("','");
b.Append(cbSmallAnimalCost.Text);
b.Append("')" );
sqlInsertCommand1.CommandText=b.ToString();
this.sqlConnection1.Open();
sqlInsertCommand1.ExecuteNonQuery();
this.sqlConnection1.Close();
MessageBox.Show("Insert Complete. [services] " + txtServiceNumber.Text +
" Successful.","");
}