I'm developing my 1st website but when I'm trying to insert data into the SQLServer 2005 it inserting null record. I tried as it is on access. again their is a same problem.
Here is my code:
Imports System.IO
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class contactus
Inherits System.Web.UI.Page
Protected Sub submit_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.ServerClick
Dim con As New SqlConnection("Server=MADHAVI-2C085B0;Integrated Security=SSPI; database=alumniDB")
con.Open()
Dim str, str1, un, ua, uc, uco, up, ue, ucom As String
un = Request.Form.Get("uname")
ua = Request.Form.Get("uadd")
uc = Request.Form.Get("ucity")
uco = Request.Form.Get("ucountry")
up = Request.Form.Get("uphoneno")
ue = Request.Form.Get("uemail")
ucom = Request.Form.Get("ucomments")
str = "insert into contactus (UName, UAdd, UCity, UCountry, UPhoneno, UEmail, UComments) values('" & un & "','" & ua & "','" & uc & "','" & uco & "','" & up & "','" & ue & "','" & ucom & "');"
Dim cmd As New SqlCommand(str, con)
cmd.ExecuteNonQuery()
End Sub
End Class
Software/Hardware used:
ASKED:
March 17, 2009 5:01 PM
UPDATED:
March 17, 2009 7:07 PM