🔒 Closed Vb.net questions

Status
Not open for further replies.

PHC-Xes

Forum Guru
Pahelp po paturo po kapag po CS nasa combobox mag proceed po
1623737229517.png

1623737218645.png
 
Tinanggal ko na po combobox mas okay po ba na combobox or wala po nakukuha ko po kasi ito

Dim con As SqlConnection = New SqlConnection("Data Source=DESKT...

If ComboBox1.Text = "ADMIN" Then
Dim cmd As SQLCommand = New SqlCommand("Select * from TBLUSER where USERNAME..
...
...
Else
Dim cmd As SQLCommand = New SqlCommand("Select * from TBLCSUSER where USERNAME..
...
...
End If

paano po kapag wrong info nilagay paano lalagyan ng error po?
 
String Username;
String Password:
String Role;

Get the values of Username & Password pass them to string. reason (To prevent SQL Injection)

Actually there is simple way to create this.
Create one Database for all Users.
Username, Password, Role.

Query 1.
SELECT * FROM USERS_TBL WHERE Username="Administrator" and Password="Password" and Role="Administrator" ;
Query 2.
SELECT * FROM USERS_TBL WHERE Username="Administrator" and Password="Password" and Role="CS" ;

the best way to differentiate them is to use two different queries.
If the query one fail to get results.
you can use Query 2.
you can even remove combobox this way.

I hate to do this but this is the only close solution you can use for now.
there is more complicated way to do this. is to pass all data from users to arrays/model and do authentication by matching values using for loop.

I recommend you learn how to use classes, arrays & model. I find it hard to other student that prof don't teach this at school. you can try to ask your prof.

Thanks for calling jncndlcpa.
Fixed po ba User nito sa Administrator at Password or pwede ko po gawin ito?

SqlCommand("SELECT * FROM USERS_TBL WHERE Username='" & USERNAME & "' and Password= '" & PASSWORD & "' and ROLE='" & Administrator & "'" , con)
 
1623826379402.webp
1623826415714.webp
Sorry po paano ko po ipapasok dito yung

SqlCommand("SELECT * FROM USERS_TBL WHERE Username='" & USERNAME & "' and Password= '" & PASSWORD & "' and ROLE='" & Administrator & "'" , con)

Patulong po. Salamat
 
[XX='Martynaustria, c: 1294948, m: 1675661'][/XX] kulang role sa query mo. dagdagan mo.
tapos dagdagan mo ng role sa rows count.

if role = "admin" {

}
else{

}
 
[XX='Martynaustria, c: 1295012, m: 1675661'][/XX]

String a = user.txt
String b = pass.txt
String c = role.txt
SqlCommand("SELECT * FROM USERS_TBL WHERE Username= a and Password=b and ROLE=c " , con)
if (dt.Rows.Count > 0){

If c.txt = "Admin"{
admin form.
}
if c.txt = "cs"{
cs form.
}
}
 
[XX='Arjien, c: 1295213, m: 1773652'][/XX]
2 forms lang po talaga gagawin ko dito 1st login form then 2nd is search form bale lalagyan ko lang restriction si CS limited access possible po ba yun?
 
Status
Not open for further replies.

About this Thread

  • 48
    Replies
  • 995
    Views
  • 7
    Participants
Last reply from:
lockIdentifier

Trending Topics

Online now

Members online
992
Guests online
3,204
Total visitors
4,196

Forum statistics

Threads
2,290,212
Posts
29,063,303
Members
1,212,278
Latest member
bboy0505
Back
Top