hi can any1 help me ...
i want to let different user to log in a system from a database.
i know it must check it from the database bt i don't know how to do it.
i just want to use only 2 columns.
one for username and the other for password. n as for the rows it will keep increasing....
Help me plzzz.......

Hi
Create a data base.
Create a table for login with two columns one for user name and other for password.
Create a dataset.
Assign the data base table to the dataset.
Get the user name from the user and check weather it matches with the user name in the login table.Do the same for password too.
If it matches allow them to login

Sample Coding: With VB.NET and SQL SERVER
//CReate DataBase
Try
If Not File.Exists("\My Documents\myinsurance.sdf") Then
Dim engine As New SqlCeEngine
engine = New SqlCeEngine
engine.LocalConnectionString = "Data Source=\My Documents\myinsurance.sdf; " + "Password="
engine.CreateDatabase()
'To Create the Data base
engine.Dispose()
End If
Catch sqlex As SqlCeException
MsgBox(sqlex.Message)
End Try

//Table Creation
Public Function createtable()
Dim cn1 As SqlCeConnection = Nothing
cn1 = New SqlCeConnection("Data Source=\My Documents\myinsurance.sdf; " + "Password=")
Try
If cn1.State = ConnectionState.Open Then
cn1.Close()
End If
cn1.Open()

Dim sqlCreateTable As SqlCeCommand = cn1.CreateCommand()
sqlCreateTable.CommandText = "CREATE TABLE TABLENAME(fieldname datatype, fieldname datatype)"
sqlCreateTable.ExecuteNonQuery()
cn1.Close()
Catch sce As SqlCeException
MessageBox.Show(sce.Message)
End Try
End Function

Insert values to the data base by usind INSERT INTO TABLENAME(fieldname,fieldname)VALUES('value1','value2') command

'Now assign the table to dataset
dim ds as new DataSet
dim row_count as integer
Dim da3 As New SqlCeDataAdapter("SELECT * FROM TABLENAME", cn3)
da3.Fill(ds, "TABLENAME")
row_count = ds.Tables("TABLENAME").Rows.Count
For row_index = 0 To row_count - 1 Step 1
if username.Text=ds.Tables("TABLENAME").Rows(row_index).Item("Username") AND password.Text=ds.Tables("TABLENAME").Rows(row_index).Item("Password") THEN
//Now allow the uer to login
// username.Text and password.Text=The value receviced from user in run time
Next row_index

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.