'Declare and create an instance of the object (CON) from the SqlConnetion Class
Dim CON as New SqlConnection("server= webserve;database=student;uid=student;pwd=icc;")
'Declare variable(SQL) and assign its value
Dim SQL as String="Insert into Products values(@name,@type,@price)"
'Declare and create an instance of the object(CMD) from SqlCommand Class
Dim CMD as New SqlCommand (SQL,CON)
CMD.Parameters.Add(New SqlParameter(“@name”,SqlDBType.Varchar,30))
CMD.Parameters(“@name”).Value = ProdName.text
CMD.Parameters.Add(New SqlParameter(“@type”,SqlDBType.Varchar,30))
CMD.Parameters(“@type”).Value = ProdType.text
CMD.Parameters.Add(New SqlParameter(“@price”,SqlDBType.Decimal,30))
CMD.Parameters(“@price”).Value = ProdPrice.text
'Execute Insert
Con.open()
CMD.ExecuteNonQuery()
Con.close()
‘ Display a message to the user
msg.text="Record Inserted Successfully"