| | |
Inserting values into the database using a asp.net button click
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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 2.0 3.5 activexcontrol ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# c#gridviewcolumn cac checkbox class commonfunctions compatible confirmationcodegeneration content contenttype countryselector courier dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal forms formview gridview gudi homeedition iis javascript jquery listbox menu microsoft mouse mssql nameisnotdeclared news opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers





