Hi,
I get the error:
Format of the initialization string does not conform to specification at Index 33. I was hoping if someone could help me on this situation. The code is listed below.
'code
Imports System.Web.Mail
Imports System.Data
Imports System.Data.OleDb
'end code
Partial Class _Default
Inherits System.Web.UI.Page
'set the variables needed
Dim SqlConnectionString As String
Dim SqlConnectionStatus As String = "Closed"
Dim Sqlconnection As New OleDbConnection
Dim Sqlcommand As New OleDbCommand(sqlinsert, Sqlconnection)
Dim SqlData As OleDbDataReader
Dim sqlinsert As String
'Function used to open the Database
Function sqlDBconnection() As Object
'creating the connection string
SqlConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='~\FDXDB3.mdb;User ID=Admin;Password=;"
'set the connection string into the SQL connection
Sqlconnection.ConnectionString = SqlConnectionString
'open the connection
Sqlconnection.Open()
'Check to see if it was successful
If Sqlconnection.State = ConnectionState.Open Then
'Set the connection status to open
SqlConnectionStatus = "Open"
End If
'Return the connection status
Return SqlConnectionStatus
End Function
'Function used to close the database
Function SqlDBConnectionClose() As Object
'close the connection
Sqlconnection.Close()
'check to see if the connection is closed or open
If Sqlconnection.State = ConnectionState.Open Then
'Keep the connection as Open
SqlConnectionStatus = "Open"
Else
'Set the Connection Status as Closed
SqlConnectionStatus = "Closed"
End If
Return SqlConnectionStatus
End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'This opens the Database so you can enter information into ti
Try
sqlDBconnection()
Catch ex As Exception
'If it doesnt, then it will display the error message
Response.Write(ex.Message)
Exit Sub
End Try
sqlinsert = "INSERT INTO FDXUSER(First_Name,Last_Name,Email,Station_ID,User_Name,Password,SQ_1,SA_1,SQ_2,SA_2,SQ_3,SA_3,Security_Level)Values(" & first_name.Text & "," & last_name.Text & "," & email_address.Text & ",'" & Stationident.SelectedValue & "'," & User_Name.Text & "," & password1.Text & "," & "*,*,*,*,*,*,3)"
Try
Sqlcommand.CommandText = sqlinsert
Sqlcommand.Connection = Sqlconnection
Sqlcommand.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.Message)
Exit Sub
End Try
'This will close the DB
Try
SqlDBConnectionClose()
Catch ex As Exception
Response.Write(ex.Message)
Exit Sub
End Try
'This will close the database
SqlDBConnectionClose()
'Below will send out an email to the following email that was provided
Try
Dim theMessage As String
password1.Text.ToUpper()
password2.Text.ToUpper()
theMessage = "Thank you for subscribing to the Fedex Newsletter<br/>"
theMessage += "This email contains your membership details. Please keep it safe<br/>"
theMessage += "If you lose this information, please contact administration to obtain this info<br/>"
theMessage += "Below is your login information:<br/>"
theMessage += "Username: " + User_Name.Text + "<br/>"
If password1.Text = password2.Text Then
theMessage += "Password: " + password1.Text + "<br/>"
Else
Dim ex As String = "Sorry Your first password is different from your second"
Response.Write(ex)
Exit Sub
End If
theMessage += "Thanks for using our website"
Dim mailMessage As New MailMessage()
mailMessage.From = "tyleryokley@hotmail.com"
mailMessage.To = email_address.Text
mailMessage.Subject = "Account Information"
mailMessage.BodyFormat = MailFormat.Html
mailMessage.Body = theMessage
mailMessage.Priority = MailPriority.High
SmtpMail.SmtpServer = "smtp.comcast.net"
SmtpMail.Send(mailMessage)
Response.Redirect("confirmreg.htm")
Catch ex As Exception
Response.Write(ex.Message)
Exit Sub
End Try
End Sub
End Class