Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Autentikacija korisnika asp.net

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 09.08.2006 12:16    Post subject: Autentikacija korisnika asp.net Add user to your forum ignore list Reply with quote

Poz Smile

Prelazim na asp.net pa sam odmah na početku zapeo Smile

Želim da provjerim koji korisnik se prijavio pomoću korisničkog imena i lozinke koji su pohranjei u bazi. Jezik koji koristim je C# baza je SQLExpress

dakle, imam formu i u njoj text box txtUsername i txtPassword

Sada želim da na klik submit se provjeri u bazi dali postoji pohranjeno username i password koji je upisan. Tabela je Tbl_Users a poljau tabeli Username i Password

Također ukoliko postoji korisnik sa tim podacima da se kreira sessija "UserID" koja bi imala vrijednost polja UserID iz tabele Tbl_Users

Hvala unaprijed

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
fun.ky



Joined: 05 Jan 2006
Posts: 365
Location: Mostar

PostPosted: 09.08.2006 14:32    Post subject: Add user to your forum ignore list Reply with quote

U međuvremenu sam riješio problem:

Code:

        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["testnaConnectionString"].ConnectionString);
        conn.Open();
        SqlCommand com = new SqlCommand("SELECT UserID, Username, Password FROM tblUsers WHERE Username = '" + TextBox1.Text + "' AND Password = '" + TextBox2.Text + "'", conn);
        DataTable tbl = new DataTable();
       
        tbl.Load(com.ExecuteReader(CommandBehavior.CloseConnection));
        if (tbl.Rows.Count > 0)
        {
            Session["UserID"] = tbl.Rows[0]["UserID"].ToString();
        }


Eto u slučaju da još neko zapne na ovakvoj gluposti

_________________
There is no style definition for good music!
Back to top
View user's profile Send private message Visit poster's website Twitter profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group