شباب عندي برنامج طيب وفيه ارقام موظفين بيغت كود لمه اضغط اضافت موظف جديد والرقم الوظيفي موجود مسبقا يطلع لي مسج انه الرقم موجد طبعا بعد الضغط على اضافه .
Dim cmd As New OleDbCommand("select * from idtable where id =" & TextBox1.Text & "", cn) Dim dr As OleDbDataReader cn.Open() dr = cmd.ExecuteReader If dr.HasRows = True Then MsgBox("عفوا هذا الرقم موجود مسبقا")
cn.Close() Else 'كود الاضافة
Dim cm As New OleDbCommand("insert into idtable (id) values ('" & TextBox1.Text & "')", cn)
(03-07-14, 07:03 AM)Adrees كتب : السلام عليكم
ضع الكود التالي في زر الاضافة
PHP كود :
'كود التحقق من وجود الرقم
Dim cmd As New OleDbCommand("select * from idtable where id =" & TextBox1.Text & "", cn) Dim dr As OleDbDataReader cn.Open() dr = cmd.ExecuteReader If dr.HasRows = True Then MsgBox("عفوا هذا الرقم موجود مسبقا")
cn.Close() Else 'كود الاضافة
Dim cm As New OleDbCommand("insert into idtable (id) values ('" & TextBox1.Text & "')", cn)