I'm making a OLE DB connection in code and was wondering if anyone could identify what the syntax errors would be in this just as it is pasted (I tried putting & _ at the end of the first line and that only brought up other errors): New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data & _ Source=" & Server.MapPath("~/App_Data/Lowes.mdb") & ";" & _ "Initial Catalog=Assets;Integrated Security=SSPI") another variation I've tried is: New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath("~/App_Data/Lowes.mdb") " &";Initial & _ Catalog=Assets;Integrated Security=SSPI") Any ideas? Thanks!!!!!
"slinky" wrote in message news:1186690631.326403.44090@x35g2000prf.googlegroups.com... > I'm making a OLE DB connection in code and was wondering if anyone > could identify what the syntax errors would be in this just as it is > pasted (I tried putting & _ at the end of the first line and that > only brought up other errors): > > New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data & _ > Source=" & Server.MapPath("~/App_Data/Lowes.mdb") & ";" & _ > "Initial Catalog=Assets;Integrated Security=SSPI") > > another variation I've tried is: > > New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & > _ > Server.MapPath("~/App_Data/Lowes.mdb") " &";Initial & _ > Catalog=Assets;Integrated Security=SSPI") > > > Any ideas? Thanks!!!!! > Your basic problem is that you need to properly embed quotqtion marks within the string you're trying to create. One way to do this is illustrated by the connection string created when creating a Data Connection: connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\CIT1713_Murach2005_IRK\ASP20\Project databases\TechSupport.mdb"" providerName="System.Data.OleDb" /> The above is XML. The article below will help you with the Microsoft.VisualBasic.ControlChars class and how to create an embeddable quote character: http://msdn2.microsoft.com/en-us/library/microsoft.visualbasic.controlchars.quote.aspx