473,714 Members | 2,623 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 2135
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
2034
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
2000
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
7466
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
2580
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
9463
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
1368
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
2913
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
8801
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
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9174
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9074
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
7953
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...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4464
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
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2110
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.