| | |
Inserting values into the database using a asp.net button click
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 37
Reputation:
Solved Threads: 0
Hi all,
I am new to asp.net programming and i have to design a website which should accept values from the user and store it in the databse on a button click event.
I am not able to do it In fact i have written a code for button click the code is as follows:
the problem that i am facing is at
cmd.ExecuteNonQuery()
the error message i am getting is tht the ExecuteNonQuery is not initialized..
Thanks in advance ...
Karthik.
I am new to asp.net programming and i have to design a website which should accept values from the user and store it in the databse on a button click event.
I am not able to do it In fact i have written a code for button click the code is as follows:
ASP.NET Syntax (Toggle Plain Text)
Dim conn As New SqlConnection conn.ConnectionString = "data source=.\\SQLEXPRESS;initial catalog=HRDATA;integrated security=true" Dim cmd As New SqlCommand cmd.CommandText = "INSERT INTO Employee Data values ('" & txt_name.Text & "')" cmd.Connection = conn conn.Open() cmd.ExecuteNonQuery() conn.Close()
the problem that i am facing is at
cmd.ExecuteNonQuery()
the error message i am getting is tht the ExecuteNonQuery is not initialized..
Thanks in advance ...
Karthik.
•
•
Join Date: Dec 2008
Posts: 37
Reputation:
Solved Threads: 0
Hi Dani,
Thanks for your reply and i have a new problem with the insert command that iam using please help me out
Whats wrong with my insert command that i am using in my code...
Thanks in advance
Karthik.
Thanks for your reply and i have a new problem with the insert command that iam using please help me out
ASP.NET Syntax (Toggle Plain Text)
myCommand = New SqlCommand("Insert into Employee Data values(ddlid.selectedItem,'" & txtname.Text & "',ddldesig.selectedItem,'" & txtcontno & "')", "myConnection")
Whats wrong with my insert command that i am using in my code...
Thanks in advance
Karthik.
Hi, you still forgot for DropDownList
ASP.NET Syntax (Toggle Plain Text)
myCommand = New SqlCommand("Insert into Employee Data values('" & ddlid.selectedItem & "','" & txtname.Text & "','" & ddldesig.selectedItem & "','" & txtcontno.Text & "')", "myConnection")
Last edited by peter_budo; Dec 21st, 2008 at 4:55 am. Reason: Please, either use [code] or [code=asp.net] (or other langiage as necessary). DO NOT USE [QUOTE]
NEVER NEVER NEVER GIVE UP
![]() |
Similar Threads
- insert data Queries. (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: After migration ASP.Net 1.1 to 3.5: TreeView control is not displaying data in hierar
- Next Thread: IDE for ASPX
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos appliances asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox click commonfunctions control css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iframe iis javascript listbox login microsoft mono mouse mssql multistepregistration news novell numerical objects opera panelmasterpagebuttoncontrols radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





