الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

البحث عن كلمة سر مربوطة بقاعدة بيانات sql sever

مغلق
بدأه dreamer في 26 نوفمبر 2005 · 13 رد · 1,025 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

أرجو مساعدتي فيما يلي جزاكم الله خيرا

أنا الآن قمت بتصميم فورمين، الأول يقوم المستخدم فيه بادخال رقمه وكلمة السر فإن تطابقت مع محتوياتها في الداتا بيس الخاصة بهما يتم نقل المستخدم للفورم الثاني. يعني برنامج تقليدي كغيره

عملت البرنامج لكنه لا يشتغل معي

شكرا لكم على تعاونكم الراااااااااااااائع

WindowsApplication1.rar

#2

أخي العزيز Dreamer انا سويت نفس مشروعك بس بطريقة ثانية لكن انا بحاول أتذكرها علما اني اشتغلها بالدوت نت فريم ورك 1.1

وبافتراض ان قاعدة البيانات تحتوي على جدول فيه اسم المستخدم UserName وكلمة السر Pwd من الجدول AdminUsers بالاضافة إلى أن حقل اسم المستخدم يعتبر مفتاح أساسي أو Uniqe

الفورم الأول اللي بيظهر عندي ويطالب المستخدم فرضاً يتكون من حقلين مربعي نص وزر

الحقل الأول اسم المستخدم txtUsername

الحقل الثاني كلمة السر txtPwd

الزر يسمى btnLogin

dim connstr as string = "provider=microsoft.jet.oledb.4.0; data source=" & the databasebath
dim conn as new oledbconnection(connstr)
dim adp as new oledbdataadapter
dim cmd as new oledbcommand
dim ds as new dataset

في حدث ضغط الزر btnLogin نكتب الكود التالي

cmd.commandtext="Select * from Adminusers where Username='" & txtusername.text & "' and pwd='" & txtpwd.text & "'"
cmd.connection=conn
adp.selectedcommand=cmd

try
ds.clear()
adp.fill(ds,"check_pwd")
if ds.tables(0).rows.count > 0 then
' اكتب كود الدخول إلى الفورم الثاني مباشرة
else
' رسالة خطأ تفيد بأن كلمة السر غير صحيحة
end if
catch ex as exception
end try

انا الان اشتغل من محل انترنت عشان كذا ما اقدر اطبق بس اعتقد ان الطريقة كذا واتمنى تنفع معك لأني اتذكر انها نفعت معي جدا

#3

أخي العزيز بس لو سمحت توضحلي أكتر

لأنو أنا مبتدئة

الآن هل يتطلب الكود اللي وضعته أنت آكسس داتا بيس، لأني أنا أشتغل على sql server

وإن كان ممكن ترفقلي البرنامج بملف حتى أشوفو أو أن تشرحلي خطوة خطوة شو أعمل

شكرا لك على التعاون

#4

وينكم يا جماااااااااااااااااااعة

#5

hi

am see the code and i thing am need the database to see what the problrm

so pleas send the database

or the structure of that table thats have the user name and the password

#6

Hi

The DB is nothing but two columns

one for the PF No which is the number of the employee (like the ID number), and the second column is for the password

That's it

Thanks

#7

hi

in the form you will have 2 textbox one for user name and the secound for the password and

you must have the login button

here the code for login button

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As New SqlConnection
        con.ConnectionString = "put Here the connection string to the database "
        Dim comand As New SqlCommand
        comand.CommandText = "Select Password From Table-Name Where UserName='" & txtUserName.Text & "'"
        comand.Connection = con
        Dim obj As New Object
        con.Open()
        obj = comand.ExecuteScalar
        con.Close()

        If Not obj Is Nothing Then
            If txtPassword.Text = CType(obj, String) Then
                Dim Form As New Form1
                Form.Show()
            Else
                MsgBox("the User Name or Password Is not Valied")
            End If
        End If
        
    End Sub

all you need to do just put the table name in the query and the connection string

and try it

تم تعديل هذه المشاركة بواسطة walcom في 29 نوفمبر 2005 في 13:04

#8

شكرا إلك على الرد

أخي الكود ما مشي معي ، بطلعلي خطأ في وقت التشغيل عند

obj = comand.ExecuteScalar

شو الحل؟؟؟

شكرا كتيييييييييييييير

أختك

#9

hi

am sure that the code is work coz am copy it from my project so

try to debuge and see if the connection open or not

i think the Error in connection string

byee

#10

Hi

It still does not working :(

Pleaaaaaaaaaaaaaaaaaase

Help me

the program is attached below

Thaaaaaaaaaaaaaaaaaaaaaaanks Brother

WindowsApplication1.rar

#11

hi

dont wory am solve all problem and here list of thats problem

1.connection string not valied

pwd=password of the user

uid= user name for the user in database

data source= name of computer Or sql server

**if sql server in the same computer you can use (Local) to refare for sql server

initial catalog=name of the database

you put name of table and not database

2.error in select statment

* not possible to name table log-in so call it log_in

*.cant name field PF No so i call it PF_No

finally the poroject is run

name of database test u can change to another

name of table log-in

name of field

password

PF_No

#12

hi

how are u

dont wory am solve all problem and here list of thats problem

1.connection string not valied

pwd=password of the user

uid= user name for the user in database

data source= name of computer Or sql server

**if sql server in the same computer you can use (Local) to refare for sql server

initial catalog=name of the database

you put name of table and not database

2.error in select statment

* not possible to name table log-in so call it log_in

*.cant name field PF No so i call it PF_No

finally the poroject is run

name of database test u can change to another

name of table log-in

name of field

password

PF_No

WindowsApplication1.rar

WindowsApplication1.rar

#13

HI

I don't know what to till you

It does not work, it does not work, it does not work :( :( :(

I have done alllllllllll what you told me about

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim con As New SqlClient.SqlConnection

con.ConnectionString = "pwd=sa; uid=sa; data source=(local);initial catalog=TEST;"

Dim comand As New SqlClient.SqlCommand

comand.CommandText = "Select Password From Log_In Where PF_No='" & TextBox1.Text & "'"

comand.Connection = con

Dim obj As New Object

Try

con.Open()

obj = comand.ExecuteScalar

con.Close()

Catch ex As Exception

End Try

If Not obj Is Nothing Then

If TextBox2.Text = CType(obj, String) Then Dim Form As New Form2

Form.Show()

Else

MsgBox("the PF No. or Password Is not Valied")

End If

End If

End Sub

the trouble now is in this statement

If TextBox2.Text = CType(obj, String) Then :( :( :(

#14

Brother, if you don't have the time, don't bother your self

and thanks to all waht you did before

هذا الموضوع مغلق.

مواضيع مشابهة