Oke, mijn vorige topic werd gesloten (mijn schuld had 100 regels code ingegeve) dus ik post ff een nieuw. 't Is een beetje tegen de regels maar dit topic zal de P&W-faq volgen
.
Dus eerst de code:
De volledige code staat op [rml][ ASP.net] Zoek de fout :)[/rml]
Nu geeft dit deze error:
Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
Source Error:
Line 62:
Line 63: connection.Open()
Line 64: Dim numRowsAffected as Integer = command.ExecuteNonQuery()
Line 65: connection.Close()
Line 66:
Ik heb mijn sql code al een paar keer nagekeken maar ik vind niets dat fout lijkt
Het zit dus in deze regel; denk ik:
Dim command as New OleDbCommand( "Insert into Screens (Image, contenttype, Beschrijving) Values ( @Image, @Contenttype, @Beschrijving )", connection )
Ziet iemand wat er mis zou kunnen zijn?
Dus eerst de code:
Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| Function MyDatabaseMethod(imgName As String, imgbin As Byte(), imgcontenttype as String) As Integer Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;data source=" & server.mappath("\bin\games.mdb") & ";" Dim connection As OleDbConnection = New OleDbConnection(strConnection) Dim command as New OleDbCommand( "Insert into Screens (Image, contenttype, Beschrijving) Values ( @Image, @Contenttype, @Beschrijving )", connection ) command.Parameters.Add( "@Image", imgbin ) command.Parameters.Add( "@Beschrijving", imgName ) command.Parameters.Add( "@Contenttype", imgcontenttype ) connection.Open() Dim numRowsAffected as Integer = command.ExecuteNonQuery() connection.Close() Return numRowsAffected End Function |
De volledige code staat op [rml][ ASP.net] Zoek de fout :)[/rml]
Nu geeft dit deze error:
Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
Source Error:
Line 62:
Line 63: connection.Open()
Line 64: Dim numRowsAffected as Integer = command.ExecuteNonQuery()
Line 65: connection.Close()
Line 66:
Ik heb mijn sql code al een paar keer nagekeken maar ik vind niets dat fout lijkt
Het zit dus in deze regel; denk ik:
Dim command as New OleDbCommand( "Insert into Screens (Image, contenttype, Beschrijving) Values ( @Image, @Contenttype, @Beschrijving )", connection )
Ziet iemand wat er mis zou kunnen zijn?