Fanabroken
New Member
System.Data.OleDb.OleDbConnection Con = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:inetpubdatabasesimageTest.mdb");<BR><BR>I get the error. Compiler Error Message: CS1002: ; expected<BR><BR>I basically got the code from DotNetJunkies (uploading images to databases) and modified the connection line.<BR><BR>The DotNetJunkies code is:<BR><BR>System.Data.OleDb.OleDbConnection Con = new System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" +<BR>"Integrated Security=SSPI;Initial Catalog=northwind");<BR><BR>Any advice would be appreciated. Thanks in advance.<BR><BR>K.Simple mistake! I'll give you a clue: C# is case sensitive. Look at the sample constructor and your constructor - see the difference?If you were talking about the word "new", that is not the problem.Hmmmm... well, I copied and pasted your code, ran it, got the same error. I then changed "New" to "new", ran it, no error.<BR><BR>Post your exact code. What editor are you using to develope with?I'm just using notepad. Here is where I got the code from:<BR><BR>http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=137<BR><BR>and I changed the connection.<BR>copy/paste this and run it:<BR>System.Data.OleDb.OleDbConnection Con = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:inetpubdatabasesimageTest.mdb"); <BR>Error is as follows:<BR><BR>A new expression requires () or [] after type<BR><BR>Buggin!where?System.Data.OleDb.OleDbCommand OleDbCmdObj = New System.Data.OleDb.OleDbCommand(SqlCmd, Con);Syntax error in INSERT INTO statement.<BR><BR>System.String SqlCmd = "INSERT INTO Images (Image, ContentType, ImageDescription, <BR><BR>ByteSize) VALUES (?, ?, ?, ?)";That is because your SQL is invalid. Look at your values:<BR>VALUES (?, ?, ?, ?)<BR>What is that supposed to be?<BR>What is the error? Also, it is "new" - not "New"http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=137 <BR><BR>I just wanted to make this work for Access 2000. It looked like all I had to do was change the connection string, but obviously it will take more!