23-09-20, 01:48 AM
بصراحة انا لا اعلم شيئا عن الاضافة بهذه الطريقة ربما يفيدك الاخوة
ولكن على اي حال الطريقة الافضل هي استخدام SqlCommand
هذا الاسلوب افضل والله اعلم
https://stackoverflow.com/a/12634626/14137871
ولكن على اي حال الطريقة الافضل هي استخدام SqlCommand
كود :
Dim query as String = "INSERT INTO student (colName, colID, colPhone, colBranch, colCourse, coldblFee)
VALUES (@colName,@colID, @colPhone, @colBranch,@colCourse, @coldblFee)"
Using conn as New SqlConnection("Server= \SQLEXPRESS; Database = mail; Integrated Security = true")
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@colName", strName)
.Parameters.AddWithValue("@colID", strId)
.Parameters.AddWithValue("@colPhone", strPhone)
.Parameters.AddWithValue("@colBranch", strBranch)
.Parameters.AddWithValue("@colCourse", strCourse)
.Parameters.AddWithValue("@coldblFee", dblFee)
End With
Try
conn.open()
comm.ExecuteNonQuery()
Catch(ex as SqlException)
MessageBox.Show(ex.Message.ToString(), "Error Message")
End Try
End Using
End USingهذا الاسلوب افضل والله اعلم
https://stackoverflow.com/a/12634626/14137871

