Operator '&' is not defined for types 'String'
Hi
I am currently trying to use the INSERT INTO command to insert information entered in TextBoxes into a Database Table named Customers.
I keep getting one particular error in my code that is throwing me a bit, please see the code below that I am using: -
<script runat="server">
Dim DBConnection As OleDbConnection
Dim DBCommand As OleDbCommand
Dim DBReader As OleDbDataReader
Dim SQLString As String
Sub CreateButton_Click(Src As Object, Args As CommandEventArgs)
DBConnection = New OleDbConnection ( _
ConfigurationSettings.AppSettings("ConnectionStrin g"))
DBConnection.Open()
SQLString = "INSERT INTO Customers " & _ "(CustomerName, JoinDate, Address1," & _
"Address2, County, PostCode, EmailAddress, SiteLogin," & _
"SitePassword) VALUES (" & _
"'" & CusName & "', " & _
"'" & Today & "', " & _
"'" & Address1 & "', " & _
"'" & Address2 & "', " & _
"'" & County & "', " & _
"'" & Postcode & "', " & _
"'" & ConfirmEmail & "', " & _
"'" & UserName & "', " & _
"'" & ConfirmUserPass & "')"
dbCommand.ExecuteNonQuery() ' to run command not to expect a result to give slight performance increase.
dbConnection.Close() ' close the connection.
If Page.IsValid = True Then
Status.Text = "Account Created!" ' alert to advise visitor the account created.
Create.Enabled = False
' Create a new user in the database.
End If
End Sub
The line that is creating this error is in red, any suggestions of why this is happening?
Thanks
Sharon
|