By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,735 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

ERROR when INSERTING VALUES into SQL database

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
For a radiobuttonlist, use rbl.SelectedValue.

Varchar fields will accept input from textboxes, as long as they are
declared with sufficient size.

Integer types will usually automatically cast string values if they
are simple numeric values.

Some simple experimentation should clarify these issues.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.