Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a record to MS Access DB
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00689664
Message ID:
00689980
Vues:
17
It is a known issue...

Check out this KB article..

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q175168

>Hi,
>
>I'm trying to add a record an Access DB with the following code in a VB.Net webform:
>
>
>
>Private Function fnAddtoDatabase() As Boolean
>
>        Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; DATA Source=c:\Inetpub\wwwroot\database\LuckyDog.mdb;"
>        Dim objConn As New System.Data.OleDb.OleDbConnection(strConn)
>        Dim objCmd As New System.Data.OleDb.OleDbCommand()
>        Dim strSQL As String
>
>        strSQL = "Insert Into DataDictRegistration(FirstNameVC,LastNameVC,CityVC," _
>               & "StateVC,CountryVC,EMailVC,CompanyNameVC,ReceiveUpdatesBT) " _
>               & "VALUES('" & strFirstName & "'," _
>               & "'" & strLastName & "'," _
>                & "'" & strCity & "'," _
>                & "'" & strState & "'," _
>                & "'" & strCountry & "'," _
>                & "'" & strEMail & "'," _
>                & "'" & strCompany & "'," _
>                & "'" & strInfo & "')"
>
>        objCmd.CommandType = CommandType.Text
>        objCmd.CommandText = strSQL
>        objCmd.Connection = objConn
>
>        objConn.Open()
>
>        objCmd.ExecuteNonQuery()
>
>        objConn.Close()
>
>        fnAddtoDatabase = True
>
>    End Function
>
>
>
>When I try this, I get the following error information on "objCmd.ExecuteNonQuery()" ...
>
>
>
>[OleDbException (0x80004005): Operation must use an updateable query.]
>
>
>
>Any idea what I'm doing wrong here (by the way, I do intend to add "Try,Catch..." error handling once I get past this hurdle) ?
- Jayesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform