Converting text data to money
- From: "nbohana" <nbohana@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 May 2005 21:25:03 -0700
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.","");
}
--
Norm Bohana
.
- Follow-Ups:
- Re: Converting text data to money
- From: Cor Ligthert
- Re: Converting text data to money
- Prev by Date: Re: SQLDATA ADAPTER WILL NOT UPDATE
- Next by Date: Re: Insert copy auto_increment to another column
- Previous by thread: using Integrated Security SSPI with User ID
- Next by thread: Re: Converting text data to money
- Index(es):