I'm new to OOP and trying create an insert method to insert a customer in a SQL Server table from a Detail View on a Web page using VB.net in a Customer Class.
My code so far looks like:
Public Function InsertCustomer(??) As Integer
Dim strCnn As String = ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString
Dim cnn As New SqlConnection(strCnn)
Dim strSQL As String
strSQL = "INSERT INTO Customer(CustomerName) VALUES(@CustomerName) "
Dim cmd = New SqlCommand(strSQL, cnn)
cmd.CommandType = "Text"
My problem is how to declare the variables for the Method Parameters to be used in the Query and how to set the @Parameters in the code. If you have some code that would help, I would really appreciate it. I've been searching the Web all day without any luck.
Thanks for our help