Re: ERROR in INSERTING data into SQL database

From: Chris Calzaretta (ccalzaretta2_at_mn.rr.com)
Date: 12/22/04


Date: Wed, 22 Dec 2004 17:28:06 -0600

I do not know how to do this in c# but in vb.net it is as
you have
 sqlCommand1.Parameters["@b"].Value=System.DateTime.Parse(TextBox1.Text);
Try
sqlCommand1.Parameters["@b",System.DateTime.Parse(TextBox1.Text)];

vb it would be
sqlCommand1.Parameters.add("@SQL_Var",Value)

"pmud" <pmud@discussions.microsoft.com> wrote in message
news:4BB79A70-93DF-4919-8CAC-2ADB7A528937@microsoft.com...
>
> -- I have an ASP.NET web application using C# code. I am trying to insert
> values from a web form into an SQL database. I am using SQL COMMAND object
> for this.
>
> I need to know HOW TO INSERT THE RADIO BUTTON LIST SELECTION entered by
> the
> user in the web form into tha database. for eg. for inserting values from
> a
> text box into the database we write code ::
> sqlCommand1.Parameters["@a"].Value =TextBox1.Text
> & for inserting integer values we write::
> sqlCommand1.Parameters["@a"].Value =int.Parse(TextBox1.Text);
>
> But what for a radio button list ? Also, how to insert value into the
> field
> of SQL table whose datatype instead of text is specified as
> 1. VARCHAR
> 2. BIGINT (is it same as int.Parse(TextBox1.Text) )
> 3. SmallDateTime (is it same as
> sqlCommand1.Parameters["@b"].Value=System.DateTime.Parse(TextBox1.Text);
>
> Please help.
>
> Thanks
>
> pmud