Hi everybody. I'm having a problem in creating/adding a new user to the system. The data entered by the user didn't inserted in the database. There are no errors in bugging mode. Please help
Protected Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim cmdInsert As OleDbCommand
Dim strInsert As String
Source=" & Request.PhysicalApplicationPath & "\FiST.mdb;")
Dim context As HttpContext
context = HttpContext.Current
url = context.Request.Url.ToString()
IP = context.Request.UserHostAddress.ToString()
logintime = Format(Now(), "hh:mm:ss tt")
logindate = Format(Now(), "dd/MM/yyyy")
If txtUsID.Text = "" And txtName.Text = "" And txtPsswd.Text = "" And txtDptmnt.Text = "" And txtCntct.Text = "" Then
Label7.Text = "Add User FAILED"
Else
strInsert = "INSERT INTO UserData ([User_ID],[User_name],[User_password]) VALUES (@us_ID,@us_name,@us_password)"
cmdInsert = New OleDbCommand(strInsert, con)
cmdInsert.Parameters.AddWithValue("@us_ID", txtUsID.Text)
cmdInsert.Parameters.AddWithValue("@us_name", txtName.Text)
cmdInsert.Parameters.AddWithValue("@us_password", txtPsswd.Text)
Try
con.Open()
cmdInsert.ExecuteNonQuery()
con.Close()
activity = "Succesfully save new user"
Catch ex As Exception
con.Close()
Label7.Text = "Save New User FAILED"
activity = "Save new user failed"
End Try
Response.Redirect("home.aspx")
End If
End Sub
Protected Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim cmdInsert As OleDbCommand
Dim strInsert As String
Source=" & Request.PhysicalApplicationPath & "\FiST.mdb;")
Dim context As HttpContext
context = HttpContext.Current
url = context.Request.Url.ToString()
IP = context.Request.UserHostAddress.ToString()
logintime = Format(Now(), "hh:mm:ss tt")
logindate = Format(Now(), "dd/MM/yyyy")
If txtUsID.Text = "" And txtName.Text = "" And txtPsswd.Text = "" And txtDptmnt.Text = "" And txtCntct.Text = "" Then
Label7.Text = "Add User FAILED"
Else
strInsert = "INSERT INTO UserData ([User_ID],[User_name],[User_password]) VALUES (@us_ID,@us_name,@us_password)"
cmdInsert = New OleDbCommand(strInsert, con)
cmdInsert.Parameters.AddWithValue("@us_ID", txtUsID.Text)
cmdInsert.Parameters.AddWithValue("@us_name", txtName.Text)
cmdInsert.Parameters.AddWithValue("@us_password", txtPsswd.Text)
Try
con.Open()
cmdInsert.ExecuteNonQuery()
con.Close()
activity = "Succesfully save new user"
Catch ex As Exception
con.Close()
Label7.Text = "Save New User FAILED"
activity = "Save new user failed"
End Try
Response.Redirect("home.aspx")
End If
End Sub