473,756 Members | 4,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ERROR when INSERTING VALUES into SQL database

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.Par ameters["@a"].Value =TextBox1.Text
& for inserting integer values we write::
sqlCommand1.Par ameters["@a"].Value =int.Parse(Text Box1.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(TextB ox1.Text) )
3. SmallDateTime (is it same as
sqlCommand1.Par ameters["@b"].Value=System.D ateTime.Parse(T extBox1.Text);

Please help.

Thanks

--
pmud
Jul 21 '05 #1
1 2142
For a radiobuttonlist , use rbl.SelectedVal ue.

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2036
by: ketulp_baroda | last post by:
Hi I am storing the attachment in the database. For some file the data gets stored in the database but for other files it gives a MySql error. For eg. when I am trying to attach the file say foo.txt it gets stored in database correctly whereas the file bar.txt gives an error. The error given is: Traceback (most recent call last): File "fakeloginserver.py", line 567, in _doRequest
3
2003
by: ketulp_baroda | last post by:
Hi I am storing the attachment in the database. For some file the data gets stored in the database but for other files it gives a MySql error. For eg. when I am trying to attach the file foo.txtit gets stored in database correctly whereas the file bar.txt gives an error. The error given is: Traceback (most recent call last): File "fakeloginserver.py", line 567, in _doRequest
1
2113
by: dmiller23462 | last post by:
Hey guys.... I put an error-handling in my page and have it posted at the complete end of the code, see below(when people were putting in 's I was getting the delimiter errors). Great, I understand that now and it seems to be fixed but the data I'm pulling from the HTML fields is not being appended correctly do my Access DB....The field in the DB now reads " ' ". I understand why it does that (my function) but what I need it to read is...
4
7470
by: M | last post by:
Hello, I have a very simple table, and want to create a trigger that updates the date column entry (with the current date), whenever a row gets modified. Is there a simple way of fixing this, or would I have to create 3 extra triggers, a package, etc., as described in most posts about mutating table errors? Could you please explain to me WHY this error happens here (I have not been able to find a clear explanation of what causes them)?
2
2581
by: altergothen | last post by:
Hi there I am a newbie to ASP.Net - Please Help! I am trying to insert the values of my variables into a database. If I try the following it works perfectly: string insertQuery = "INSERT into test(name,surname,email) VALUES('Bob', 'Sly', 'bobsly@yahoo.com')"; but instead of inputing the values directly, I want to insert them as variables like so:
2
450
by: pmud | last post by:
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.Value =TextBox1.Text & for inserting integer values we write::...
2
9476
by: Charles Wilt | last post by:
I have a IBM iSeries (aka AS-400) running v5r3 of OS/400 that I access via a linked server from SQL Server 2000. The following select works fine: select * from prod400db.test.meldbf.InventoryHistory However, this insert statement fails: insert into prod400db.TEST.MELDBF.InventoryHistory
0
1371
by: pere | last post by:
hi everybody, I have a script that inserts .csv data into a table; I want different users to insert their data in the same table. To differenciate them I make them fill a name (called "nom") field in the html before uploading the .csv. But when another user uploads data, the previous one disappears! I just use a INSERT INTO values, so it should not happen. Sorry if there are big mistakes, but I'm newbie in Perl (the script is not...
0
2917
by: mbenedict | last post by:
I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use dbms_lob.writeappend, I am getting the following error..Command text was not set for the command object. I've researched this in the net as much as I could, but I'm lost in what I am doing wrong. Can you help please? Here is my code... ...
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.