Everton1Blue
Technical User
Hello
I have the following my ASP.NET project. It's just a simple form that inserts form field data into a database. In my aspx.vb file I have:
I suspect the problem is here with this part of the code: myMDBConnection
Thanks for and advice!
I have the following my ASP.NET project. It's just a simple form that inserts form field data into a database. In my aspx.vb file I have:
Code:
Imports here including: Imports System.Data.OleDb
Partial Class Account_Register
Inherits System.Web.UI.Page
Protected Sub
Dim myMDBConnection As OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myDatabase.mdb;")
myMDBConnection.Open()
myMDBConnection.Close()
End Sub
Protected Sub CreateUser_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Using conn As New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("usersConnectionString").ConnectionString)
Dim Sql As String = "INSERT INTO userlist (username,password, strEmail) VALUES (@username,@password, @strEmail)"
Dim cmd As New OleDbCommand(Sql, conn)
conn.Open()
cmd.Parameters.AddWithValue("@username", username.Text)
cmd.Parameters.AddWithValue("@password", password.Text)
cmd.Parameters.AddWithValue("@strEmail", strEmail.Text)
cmd.ExecuteNonQuery()
conn.Close()
End Using
End Sub
End Class
I suspect the problem is here with this part of the code: myMDBConnection
Thanks for and advice!