OLEDB connection and DataShaping

Results 1 to 2 of 2

Thread: OLEDB connection and DataShaping

  1. #1
    Join Date
    Dec 1969

    Default OLEDB connection and DataShaping

    I have an app that uses data shaping and a system DSN. I want to convert it to DSN-less connection but that would require two conn.Provider statements. Here is the code: <BR>Existing code: <BR>set conn = Server.CreateObject("ADODB.connection")<BR>conn.Pr ovider = "MSDataShape"<BR>conn.ConnectionString = "benefits" &#039a system DSN<BR>What I want to do:<BR>set conn = Server.CreateObject("ADODB.connection")<BR>conn.Pr ovider = "Microsoft.Jet.OLEDB.4.0"<BR>conn.ConnectionSt ring = "Data Source=" & Server.MapPath ("DBname.mdb") &#039no DSN required<BR><BR>If I try to shape with the OLEDB provider, I get this error:<BR>Microsoft JET Database Engine error &#039 80040e14&#039 <BR>Invalid SQL statement; expected &#039DELETE&#039, &#039INSERT&#039, &#039PROCEDURE&#039, &#039SELECT&#039, or &#039UPDATE&#039. <BR><BR>/hrform/showBen.asp, line 34 <BR><BR>If I try it with the provider set to MSDataShape, I get this error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR>[Microsoft][ODBC Driver Manager] Data source name too long <BR><BR>/hrform/showBen.asp, line 32 <BR><BR>There has to be a way to do both, because I have to use DSN-less connection, and would prefer to use data shaping. Any ideas? <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: OLEDB connection and DataShaping

    An example I found uses a DSN-less connection. Try something like this:<BR>---------------------------------------------------------------<BR>set objConn = Server.CreateObject("ADODB.Connection")<BR>&#039--- Generate the connection string using the <BR>&#039--- OLE DB provider Access and the Data Shaping provider.<BR><BR>strConn = "Data Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;"<BR><BR>strConn = strConn & "Data Source= e:CurrentProjectsAuditWeb PagesDataShapingAdvWorks.mdb"<BR><BR>objConn.Conne ctionString = strConn<BR><BR>&#039--- Specify that we will use the Data Shaping provider.<BR>objConn.Provider = "MSDataShape"<BR><BR>&#039--- Open the connection<BR>objConn.Open<BR><BR>---------------------------------------------------------------<BR>If you want to see the entire example goto the following site and click on the "download the code" link:<BR><BR>http://msdn.microsoft.com/library/periodic/period99/shaping.htm<BR><BR>Once you download the file, you&#039ll have the modify the path of the .mdb file to get the code to work. The download file zipped file that contains a .asp file, .mdb file and 2 .gif files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts