pls i need someone here to help me with the coding trend am using. this is an example of my code inserting data in to sql server 2008 table...
Public Sub insertStocks(ByVal serialNumber As TextBox, ByVal itemcategory As ComboBox, ByVal itemname As TextBox, _
ByVal dateofmanufacture As DateTimePicker, ByVal dateofexpiry As DateTimePicker, _
ByVal price As TextBox, ByVal Clerkname As TextBox, _
ByVal Quantity As TextBox, ByVal measurement As ComboBox, _
ByVal Country As ComboBox, ByVal EntryDate As DateTimePicker, ByVal datag As DataGridView)
Try
If checkStocks(serialNumber, itemcategory, itemname, dateofmanufacture, dateofexpiry, price, Clerkname, Quantity, measurement, Country, EntryDate) = True Then
Dim sql As String = "INSERT INTO Registration (serialNumber, itemcategory, itemname, dateofmanufacture," & _
"dateofexpiry, price, Clerkname, Quantity, measurement, Country, EntryDate ) " & _
"VALUES ('" & serialNumber.Text & "','" & itemcategory.Text & "','" & itemname.Text & "','" & dateofmanufacture.Text & "','" & dateofexpiry.Text & "'," & _
"'" & price.Text & "','" & Clerkname.Text & "','" & Quantity.Text & "','" & measurement.Text & "'," & _
"'" & Country.Text & "','" & EntryDate.Text & "')"
serverconnection()
Dim odbcCmd As New SqlCommand(sql, sqlcon)
odbcCmd.ExecuteNonQuery()
MsgBox("New Details About [" & itemname.Text & " with Serial Number " & serialNumber.Text & " ] saved ", MsgBoxStyle.Information)
clearStocks(serialNumber, itemcategory, itemname, dateofmanufacture, dateofexpiry, price, Quantity, measurement, Country, EntryDate)
serialNumber.Focus()
loadpurchasesummary(datag)
sqlcon.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub