How to save data into the database with data in textbox in asp.net

G

Guest

hi,

i wrote the below mention code int he button click event :

Dim str As String
Dim cmd1 As SqlCommand
cmd1 = New SqlCommand()
cmd1.Connection.Open()
cmd1.Connection = Con
cmd1.Connection.Open()
str = "Insert into Table_Temp values ('" &
Convert.ToString(Request.Form("TxtSaveData") & "'")
cmd1.CommandText = str
cmd1.ExecuteNonQuery()
cmd1.Connection.Close()


it shows a error message in the executenonquery()

we are using dot net framework 1.0 version

please send the actual code so that we can progress ourself

thanking you
 
G

Guest

Hi

Your code is missing the bracket close in SQL statement.

Correct statement will be:

str = "Insert into Table_Temp values ('" &
Convert.ToString(Request.Form("TxtSaveData") & "')")

Regards
Sooraj
Microsoft Community Star
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top