14-10-18, 06:09 AM
كود :
Public Sub InsertNewRowIn_CASE11(ByVal TextBox10 As Int32, ByVal TextBox20 As String, ByVal TextBox30 As String)
Dim StrSQL As String
If TextBox30 = Nothing Then
StrSQL = "INSERT INTO Table_Product0 (Product_id , Product_name) VALUES ('" & TextBox10 & "','" & TextBox20 & "')"
Else
StrSQL = "INSERT INTO Table_Product0 (Product_id,Product_name,Product_date ) VALUES (" & TextBox10 & ",'" & TextBox20 & "','" & CDate(TextBox30) & "')"
End If
Dim cn As New SqlClient.SqlConnection("Server =(local);database=Test;integrated security=True")
Dim StrTableName As String = "Table_Product0"
If cn.State = ConnectionState.Closed Then cn.Open()
Dim da As New SqlClient.SqlDataAdapter(StrSQL, cn)
Dim dt As New DataSet
dt.Clear()
da.Fill(dt, StrTableName)
MsgBox("تم الحفظ بنجاح")
cn.Close()
End Subسبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
