Skip to main content

Posts

Showing posts with the label Validating user name and password from the database using visual basic

Visual basic Examples-Adding items from listbox to database,Validating user name and password ,Primary Key at Runtime

Adding items from listbox to database First you need to write code for connection and recordset opening then you can set following code in your program for i = 0 to list1.listcount -1 if list1.selected(i) = true then rs.addnew rs!fieldname = list1.list(i) rs.update next i Validating user name and password from the database using visual basic Set con = CreateObject("adodb.connection") con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;Persist Security Info=False" con.Execute ("select Username, Password from table1 where Username='" & UID & "'") If Not con.Execute("select * from table1 where [username]='" & txtUsername.Text & _ "' AND [password]='" & txtPassword.Text & "'").EOF Then MsgBox "Login Successfull", vbInformation, "Success!" Else MsgBox "Login Failed-Enter UserID and Pas...