I have started my first ever VS Web page today and have two pages open in the software: Register1.aspx and Web.config. I am hoping to devise a simple 'new user registration form' with three fields: username, password, and email. When the 'submit' button is clicked, those three fields should populate three fields in my MS Access database.
The code I have in my Web.config file looks like this:
<?xml version="1.0"?> <configuration> <connectionStrings> <add name="usersConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\myDatabase.mdb" providerName="System.Data.OleDb"/> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0"/> Dim cmd As OleDbCommand = New OleDbCommand(sql, conn) conn.Open() Dim sql As String = "INSERT INTO userlist (username,password, strEmail) VALUES (@username,@password, @strEmail)" Dim conn As OleDbConnection = New OleDbConnection cmd.Parameters.AddWithValue("@username", txtusername.Text) cmd.Parameters.AddWithValue("@password", txtpassword.Text) cmd.Parameters.AddWithValue("@strEmail", txtstrEmail.Text) cmd.ExecuteNonQuery() conn.Close() cmd.Dispose() conn.Dispose() </system.web> </configuration>
Does it appear that I have that script correct, please (syntax and order)?
I also wondered that if I copied and pasted the final code into Notepad and saved it as an .aspx file, how would I compile it in Command Prompt before uploading it to my server?