tehon3299
Well-known member
Hey -
I was just wondering how to use the SQL Insert Command. I have some code but I do not know how good it is. It doesnt seem to work so I was wondering what the problem was. Heres some of the code:
myConnection = New SqlConnection("server=(local);database=Pitch;Trusted_Connection=yes")
Dim InsertCmd As String = "insert into PitchRecord (Date, Name, Score, Win) values (TodayDate, team1, team1totpoints, 1)"
MyCommand = New SqlCommand(InsertCmd, myConnection)
MyCommand.Parameters.Add(New SqlParameter("TodayDate", SqlDbType.DateTime, 8))
MyCommand.Parameters("TodayDate").Value = Now()
MyCommand.Parameters.Add(New SqlParameter("Name", SqlDbType.NVarChar, 100))
MyCommand.Parameters("Name").Value = team1
Can someone please give me some insight?
Thanks,
Tehon
I was just wondering how to use the SQL Insert Command. I have some code but I do not know how good it is. It doesnt seem to work so I was wondering what the problem was. Heres some of the code:
myConnection = New SqlConnection("server=(local);database=Pitch;Trusted_Connection=yes")
Dim InsertCmd As String = "insert into PitchRecord (Date, Name, Score, Win) values (TodayDate, team1, team1totpoints, 1)"
MyCommand = New SqlCommand(InsertCmd, myConnection)
MyCommand.Parameters.Add(New SqlParameter("TodayDate", SqlDbType.DateTime, 8))
MyCommand.Parameters("TodayDate").Value = Now()
MyCommand.Parameters.Add(New SqlParameter("Name", SqlDbType.NVarChar, 100))
MyCommand.Parameters("Name").Value = team1
Can someone please give me some insight?
Thanks,
Tehon