hw come mysql DB cannt add a new record...HELP PLS!
_______________________________
Imports System.Web.Security
Public Class c8users
Inherits System.Web.UI.Page
Dim conn As Odbc.OdbcConnection
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents txtuserid As System.Web.UI.WebControls.TextBox
Protected WithEvents txtpassword As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim userid As String
Dim password As String
Sub connect()
conn = New Odbc.OdbcConnection("STMT=;OPTION=3;DSN=MySQL;UID=root;DESC=MySQL ODBC 3.51 Driver DSN;DATABASE=data;SERVER=localhost;PORT=3306")
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Sub createusers()
Dim cmdInsertPeople As Odbc.OdbcCommand
Call connect()
conn.Open()
UserID = txtuserid.Text
password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpassword.Text, "sha1")
cmdInsertPeople = New Odbc.OdbcCommand("Insert users (UserID,Password) Values(@userid,@password)", conn)
cmdInsertPeople.Parameters.Add("@userid", UserID)
cmdInsertPeople.Parameters.Add("@password", Password)
cmdInsertPeople.ExecuteNonQuery()
conn.Close()
End Sub
Function EncryptPassword(ByVal password As String)
EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1")
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
createusers()
End Sub
End Class
_______________________________
Imports System.Web.Security
Public Class c8users
Inherits System.Web.UI.Page
Dim conn As Odbc.OdbcConnection
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents txtuserid As System.Web.UI.WebControls.TextBox
Protected WithEvents txtpassword As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim userid As String
Dim password As String
Sub connect()
conn = New Odbc.OdbcConnection("STMT=;OPTION=3;DSN=MySQL;UID=root;DESC=MySQL ODBC 3.51 Driver DSN;DATABASE=data;SERVER=localhost;PORT=3306")
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Sub createusers()
Dim cmdInsertPeople As Odbc.OdbcCommand
Call connect()
conn.Open()
UserID = txtuserid.Text
password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtpassword.Text, "sha1")
cmdInsertPeople = New Odbc.OdbcCommand("Insert users (UserID,Password) Values(@userid,@password)", conn)
cmdInsertPeople.Parameters.Add("@userid", UserID)
cmdInsertPeople.Parameters.Add("@password", Password)
cmdInsertPeople.ExecuteNonQuery()
conn.Close()
End Sub
Function EncryptPassword(ByVal password As String)
EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "sha1")
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
createusers()
End Sub
End Class