السلام عليكم ورحمة الله
الفكرة برنامج لارسال رسالة نصية
المشكلة : عند اختيار القسم من القائمة المنسدلة للتحديد وقراءة جميع العملاء في هذا القسم لارسال الرسالة (ارسال رسالة جماعية) تطهر لي المشكلة
cn.Open()
Dim se As String = ("select [staff.ID],[staff.Name],[staff.depar],[staff.Job],[staff.Tel] from Staff where [staff.depar] = '" & ComboBox1.Text & "'")
Dim com As New SqlClient.SqlCommand(se, cn)
Dim re As SqlClient.SqlDataReader = com.ExecuteReader
re.Read()
While re.Read()
IDS = re.GetValue(0)
Name = re.GetValue(1)
depar = re.GetValue(2)
job = re.GetValue(3)
tel = re.GetValue(4)
re.Close()
Dim enter1 As String = "INSERT INTO ozekimessageout(sender,receiver,msg,operator,status)" & "values ('0918244733','" & tel & "','" & TextBox1.Text & "','Sudani','send') "
Dim com2 As New SqlClient.SqlCommand(enter1, cn)
com2.ExecuteNonQuery()
Dim enter As String = "INSERT INTO MSGDetails([staff.Name],[staff.depar],[staff.Job],[staff.Tel],MSG,date)" & "values ('" & Name & "','" & depar & "','" & job & "','" & tel & "','" & TextBox1.Text & "','" & DateTimePicker1.Text & "') "
Dim com1 As New SqlClient.SqlCommand(enter, cn)
com1.ExecuteNonQuery()
End While
MsgBox(" ", MsgBoxStyle.Information, "OK")
TextBox1.Text = ""
ComboBox1.SelectedIndex = -1
ComboBox1.Focus()
cn.Close()
End Sub

