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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top