I was actually having a problem that my database access. I could not get connected to my SQL database. The error is
Syntax error in INSERT INTO statement
I have tried everything but I just need help. Here is my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SqlDataSource1.InsertCommand = "INSERT INTO Information Page (RName, RCountry) VALUES ('" & TextBox1.Text & "', '" & TextBox2.Text & "')"
Label4.Text = DateTime.Now.ToString("dd MMMM yyyy h:mm")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
TextBox1.Text = " "
TextBox2.Text = " "
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
name = TextBox1.Text
country = TextBox2.Text
SqlDataSource1.Insert()
Response.Redirect("http://localhost:49179/WebForm1.aspx")
End Sub
`Information Page`or if you are using Microsoft SQL server you need to use square brackets[Information Page]