Trying to add some data to an access DB
<WebMethod()> Public Sub SaveBet(ByVal BetDate As Date, ByVal SportID As Integer, ByVal AwayTeamID As Integer, ByVal HomeTeamID As Integer, ByVal BetTypeID As Integer, ByVal TeamBet As Integer, ByVal SpreadPoints As Double)
Dim strDBPath As String = "C:\$User\Dev\WinBetTracker\Data\WinBetTracker.mdb"
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
Dim strSQL As String
Dim objConn As OleDbConnection
Dim objCmd As OleDbCommand
objConn = New OleDbConnection(strConn)
objConn.Open()
strSQL = "INSERT INTO TBL_Bets (GameDate, Sports_ID, AwayTeam_ID, HomeTeam_ID, BetType_ID, BetTeam_ID, Spread_Points) VALUES (#" & BetDate & "#," & SportID & "," & AwayTeamID & "," & HomeTeamID & "," & BetTypeID & "," & TeamBet & "," & SpreadPoints & ")"
'strSQL = "INSERT INTO TBL_BETS (GameDate, Sports_ID, AwayTeam_ID, HomeTeam_ID, BetType_ID, BetTeam_ID, Spread_Points) VALUES (#10/30/2002#,2,17,21,0,17,1)"
objCmd = New OleDbCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
End Sub
whats wrong with this?? I get an error message that it must be an updatable query. I am just starting out in .net and I am just trying to do a basic command here. Any help would be appreciate it.
thanks
<WebMethod()> Public Sub SaveBet(ByVal BetDate As Date, ByVal SportID As Integer, ByVal AwayTeamID As Integer, ByVal HomeTeamID As Integer, ByVal BetTypeID As Integer, ByVal TeamBet As Integer, ByVal SpreadPoints As Double)
Dim strDBPath As String = "C:\$User\Dev\WinBetTracker\Data\WinBetTracker.mdb"
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath
Dim strSQL As String
Dim objConn As OleDbConnection
Dim objCmd As OleDbCommand
objConn = New OleDbConnection(strConn)
objConn.Open()
strSQL = "INSERT INTO TBL_Bets (GameDate, Sports_ID, AwayTeam_ID, HomeTeam_ID, BetType_ID, BetTeam_ID, Spread_Points) VALUES (#" & BetDate & "#," & SportID & "," & AwayTeamID & "," & HomeTeamID & "," & BetTypeID & "," & TeamBet & "," & SpreadPoints & ")"
'strSQL = "INSERT INTO TBL_BETS (GameDate, Sports_ID, AwayTeam_ID, HomeTeam_ID, BetType_ID, BetTeam_ID, Spread_Points) VALUES (#10/30/2002#,2,17,21,0,17,1)"
objCmd = New OleDbCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
End Sub
whats wrong with this?? I get an error message that it must be an updatable query. I am just starting out in .net and I am just trying to do a basic command here. Any help would be appreciate it.
thanks