Search Results

Search found 176 results on 8 pages for 'adodb'.

Page 4/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Recordset Paging works in IIS6 but not in IIIS7

    - by Spudhead
    Hi there, I've got a recordset/paging set up - works fine in IIS6 but when I run the site on an IIS7 server I get the following error: Microsoft OLE DB Provider for SQL Server error '80004005' [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. /orders.asp, line 197 the code looks like this: Set objPagingConn = Server.CreateObject("ADODB.Connection") objPagingConn.Open CONN_STRING Set objPagingRS = Server.CreateObject("ADODB.Recordset") objPagingRS.PageSize = iPageSize objPagingRS.CacheSize = iPageSize objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText iPageCount = objPagingRS.PageCount iRecordCount = objPagingRS.RecordCount Line 197 is the objPagingConn,Open ... line. I've got about 10 sites like this to migrate - is there a simple fix in IIS7??? Help is greatly appreciated! Many thanks, Martin

    Read the article

  • Can't connect twice to linked table using ACE/JET driver

    - by Tmdean
    I'm trying to connect to an MS Access database linked table in VBScript. It works fine connecting the first time on one connection but if I close that connection and open a new one in the same script it gives me an error. test.vbs(13, 1) Microsoft Office Access Database Engine: ODBC--connection to '{Oracle in OraClient10g_home1}DB_NAME' failed. This is some code that triggers the error. TABLE_1 is an ODBC linked table in the test.mdb file. Dim cnn, rs Set cnn = CreateObject("ADODB.Connection") cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=test.mdb" Set rs = cnn.Execute("SELECT * FROM [TABLE_1]") rs.Close cnn.Close Set cnn = CreateObject("ADODB.Connection") cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=test.mdb" Set rs = cnn.Execute("SELECT * FROM [TABLE_1]") '' crashes here rs.Close cnn.Close This error does not occur if I try to access an ordinary Access table. Right now I'm thinking it's a bug in the Oracle ODBC driver.

    Read the article

  • Get records from Access table

    - by chianta
    On Access 2010 I need to use VBA to get the records in a table, process them and put them in a new table. Could you tell me how can I do? Is there a way similar to C # to put everything into a datatable the result of a query? I found an example on how to get the data. http://pastebin.com/bCtg20jp But it always fails on the first statement "ADODB.Recordset". I went to see the included libraries and library that uses ADODB is already included "Microsoft Access 14.0 Object Library". Thanks

    Read the article

  • Return database messages on successful SQL execution when using ADO

    - by peacedog
    I'm working on a legacy VB6 app here at work, and it has been a long time since I've looked at VB6 or ADO. One thing the app does is to executes SQL Tasks and then to output the success/failure into an XML file. If there is an error it inserts the text the task node. What I have been asked to do is try and do the same with the other mundane messages that result from succesfully executed tasks, like (323 row(s) affected). There is no command object being used, it's just an ADODB.Connection object. Here is the gist of the code: Dim sqlStatement As String Set sqlStatement = /* sql for task */ Dim sqlConn As ADODB.Connection Set sqlConn = /* connection magic */ sqlConn.Execute sqlStatement, , adExecuteNoRecords What is the best way for me to capture the non-error messages so I can output them? Or is it even possible?

    Read the article

  • How to connect to Oracle 10g server from client machines

    - by Tareq
    I have installed Oracle 10g in one of my office's computer. I want to keep this as database server. I am developing a .net project which will communicate with the database server from client machine and from the server machine. I success to communicate with oracle from server machine but not from client machine using the .net project. The connection code is as follows: Public OraConn As ADODB.Connection OraConn = New ADODB.Connection OraConn.Provider = "OraOLEDB.Oracle" OraConn.ConnectionString = "Data Source=<my_database_name>;User ID=<my_user>;Password=<my_pass>;" OraConn.Open() Please tell me step by step procedures how can I connect to my server database from my .net client program resides on client machine ? Thanks in Advance.

    Read the article

  • How to connect to a SQLite database in iphone

    - by Lee
    I am attempting converting an application from VB6 to an iphone app. In the VB version, the database is in Access. But, I have read that I need to convert it to SQLite. How I amend the following code to switch from Access to SQLite? cnList = new ADODB.Connection(); rsList = new ADODB.Recordset(); cnList.Provider = "Microsoft.Jet.OLEDB.4.0;"; cnList.ConnectionString = "Persist Security Info=False;"+CString("Data Source=cbe.mdb"); cnList.Open();

    Read the article

  • ASP Classic Named Parameter in Paramaterized Query: Must declare the scalar variable

    - by My Alter Ego
    I'm trying to write a parameterized query in ASP Classic, and it's starting to feel like i'm beating my head against a wall. I'm getting the following error: Must declare the scalar variable "@something". I would swear that is what the hello line does, but maybe i'm missing something... <% OPTION EXPLICIT %> <!-- #include file="../common/adovbs.inc" --> <% Response.Buffer=false dim conn,connectionString,cmd,sql,rs,parm connectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=.\sqlexpress;Initial Catalog=stuff" set conn = server.CreateObject("adodb.connection") conn.Open(connectionString) set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.CommandText = "select @something" cmd.NamedParameters = true cmd.Prepared = true set parm = cmd.CreateParameter("@something",advarchar,adParamInput,255,"Hello") call cmd.Parameters.append(parm) set rs = cmd.Execute if not rs.eof then Response.Write rs(0) end if %>

    Read the article

  • Simple ASP function question

    - by J Harley
    Good Morning, I have got the following function: FUNCTION queryDatabaseCount(sqlStr) SET queryDatabaseCountRecordSet = databaseConnection.Execute(sqlStr) If queryDatabaseCountRecordSet.EOF Then queryDatabaseCountRecordSet.Close queryDatabaseCount = 0 Else QueryArray = queryDatabaseCountRecordSet.GetRows queryDatabaseCountRecordSet.Close queryDatabaseCount = UBound(QueryArray,2) + 1 End If END FUNCTION And the following dbConnect: SET databaseConnection = Server.CreateObject("ADODB.Connection") databaseConnection.Open "Provider=SQLOLEDB; Data Source ="&dataSource&"; Initial Catalog ="&initialCatalog&"; User Id ="&userID&"; Password="&password&"" But for some reason I get the following error: ADODB.Recordset error '800a0e78' Operation is not allowed when the object is closed. /UBS/DBMS/includes/blocks/block_databaseoverview.asp, line 30 Does anyone have any suggestions? Many Thanks, Joel

    Read the article

  • VBScript: how to set values from recordset to string

    - by phill
    This is probably a beginner question, but how do you set a recordset to a string variable? Here is my code: Function getOffice (strname, uname) strEmail = uname WScript.Echo "email: " & strEmail Dim objRoot : Set objRoot = GetObject("LDAP://RootDSE") Dim objDomain : Set objDomain = GetObject("LDAP://" & objRoot.Get("defaultNamingContext")) Dim cn : Set cn = CreateObject("ADODB.Connection") Dim cmd : Set cmd = CreateObject("ADODB.Command") cn.Provider = "ADsDSOObject" cn.Open "Active Directory Provider" Set cmd.ActiveConnection = cn cmd.CommandText = "SELECT physicalDeliveryOfficeName FROM '" & objDomain.ADsPath & "' WHERE mail='" & strEmail & "'" cmd.Properties("Page Size") = 1 cmd.Properties("Timeout") = 300 cmd.Properties("Searchscope") = ADS_SCOPE_SUBTREE Dim objRS : Set objRS = cmd.Execute WScript.Echo objRS.Fields(0) Set cmd = Nothing Set cn = Nothing Set objDomain = Nothing Set objRoot = Nothing Dim arStore Set getOffice = objRS.Fields(0) Set objRS = Nothing End function When I try to run the function, it throws an error "vbscript runtime error: Type mismatch" I presume this means it can't set the string variable with a recordset value. How do I fix this problem?

    Read the article

  • Stored procedure does not return data if executed from VBA

    - by Sam
    I had stored procedure MySPOld in Sybase db. I created new sp MySP. This new sp returns data while executed from Sybase Sql Advantage. But not returning the data when called from VBA - Excel 2003 (EOF property of recordset is True). Here is my code.. Dim dbCon As ADODB.Connection Dim rstTemp As New ADODB.Recordset Dim query As String query = "exec MySP '01/01/2010', '01/14/2010'" dbCon.Open connectionString, "username" "password" dbCon.CommandTimeout = 300 rstTemp.Open query, dbCon, adOpenForwardOnly The code was working well with old sp. What could be the problem ? any idea ? Thanks in Advance.

    Read the article

  • SQL SELECT INSERTed data from Table

    - by Noam Smadja
    its in ASP Classic. MS-Access DB. i do: INSERT INTO Orders (userId) VALUES (123)" what i want to retrieve is orderNumber from that row. its an auto-increment number. so i did: SELECT orderNumber FROM Orders WHERE userId=123 but since it is on the same page, the SELECT returns: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. i've seen somewhere RETURNING orderNumber as variable but it was for oracle and i dont know how to implement it into my asp :( set addOrder = Server.CreateObject("ADODB.Command") addOrder.ActiveConnection = MM_KerenDB_STRING addOrder.CommandText = "INSERT INTO Orders (userId) VALUES ("&userId&")" addOrder.CommandType = 1 addOrder.CommandTimeout = 0 addOrder.Prepared = true addOrder.Execute() Dim getOrderNumber Set getOrderNumber = Server.CreateObject("ADODB.Recordset") getOrderNumber.ActiveConnection = MM_KerenDB_STRING getOrderNumber.Source = "SELECT orderNumber FROM Orders WHERE userId=" & userId getOrderNumber.CursorType = 0 getOrderNumber.CursorLocation = 2 getOrderNumber.LockType = 1 getOrderNumber.Open() session("orderNumber") = getOrderNumber.Fields.Item("orderNumber").value

    Read the article

  • putting values from database into a drop down list

    - by sushant
    hi. my tool is in asp. i am using this code for a query in sql dim req_id req_id=Request.Form("Req_id") if req_id<>"" then Set conn=server.CreateObject("adodb.connection") conn.Open session("Psrconnect") Set rs=CreateObject("Adodb.Recordset") rs.Open "select * from passwords where REQ_ID='"&req_id&"'", conn i want to put the results of this query into a drop down list. how do i do it? any help is very much appreciated.

    Read the article

  • Scripted forwarding for Outlook 2003

    - by John Gardeniers
    We have a staff member in sales who has gone onto a 4 day week (getting ready for retirement), so each Thursday afternoon her email needs to be forwarded to another user and each Friday afternoon it needs to be set back. I'm using the VBS script below to do this, run via the Task Scheduler. Although the script appears to do it's job, based on what I see when I view the user's Exchange settings, Exchange doesn't always recognise that the setting has changed. e.g. Last Thursday the forwarding was a enabled and worked correctly. On Friday the script did it's thing to clear the forwarding but Exchange continued to forward messages all weekend. I found that I can force Exchange to honour the changed setting be merely opening and closing the user's properties in ADUC. Of course I don't want to have to do that. Is there a non-manual way I can have Exchange read and honour the setting? The script (VBS): ' Call this script with the following parameters: ' ' SrcUser - The logon ID of the suer who's account is to be modified ' DstUser - The logon account of the person to who mail is to be forwarded ' Use "reset" to clear the email forwarding SrcUser = WScript.Arguments.Item(0) DstUser = WScript.Arguments.Item(1) SourceUser = SearchDistinguishedName(SrcUser) 'The user login name Set objUser = GetObject("LDAP://" & SourceUser) If DstUser = "reset" then objUser.PutEx 1, "altRecipient", "" Else ForwardTo = SearchDistinguishedName(DstUser)' The contact common name objUser.Put "AltRecipient", ForwardTo End If objUser.SetInfo Public Function SearchDistinguishedName(ByVal vSAN) Dim oRootDSE, oConnection, oCommand, oRecordSet Set oRootDSE = GetObject("LDAP://rootDSE") Set oConnection = CreateObject("ADODB.Connection") oConnection.Open "Provider=ADsDSOObject;" Set oCommand = CreateObject("ADODB.Command") oCommand.ActiveConnection = oConnection oCommand.CommandText = "<LDAP://" & oRootDSE.get("defaultNamingContext") & ">;(&(objectCategory=User)(samAccountName=" & vSAN & "));distinguishedName;subtree" Set oRecordSet = oCommand.Execute On Error Resume Next SearchDistinguishedName = oRecordSet.Fields("DistinguishedName") On Error GoTo 0 oConnection.Close Set oRecordSet = Nothing Set oCommand = Nothing Set oConnection = Nothing Set oRootDSE = Nothing End Function

    Read the article

  • Scripted redirection for Outlook 2003

    - by John Gardeniers
    We have a staff member in sales who has gone onto a 4 day week (getting ready for retirement), so each Thursday afternoon her email needs to be forwarded to another user and each Friday afternoon it needs to be set back. I'm using the VBS script below to do this, run via the Task Scheduler. Although the script appears to do it's job, based on what I see when I view the user's Exchange settings, Exchange doesn't always recognise that the setting has changed. e.g. Last Thursday the forwarding was a enabled and worked correctly. On Friday the script did it's thing to clear the forwarding but Exchange continued to forward messages all weekend. I found that I can force Exchange to honour the changed setting be merely opening and closing the user's properties in ADUC. Of course I don't want to have to do that. Is there a non-manual way I can have Exchange read and honour the setting? The script (VBS): ' Call this script with the following parameters: ' ' SrcUser - The logon ID of the suer who's account is to be modified ' DstUser - The logon account of the person to who mail is to be forwarded ' Use "reset" to clear the email forwarding SrcUser = WScript.Arguments.Item(0) DstUser = WScript.Arguments.Item(1) SourceUser = SearchDistinguishedName(SrcUser) 'The user login name Set objUser = GetObject("LDAP://" & SourceUser) If DstUser = "reset" then objUser.PutEx 1, "altRecipient", "" Else ForwardTo = SearchDistinguishedName(DstUser)' The contact common name objUser.Put "AltRecipient", ForwardTo End If objUser.SetInfo Public Function SearchDistinguishedName(ByVal vSAN) Dim oRootDSE, oConnection, oCommand, oRecordSet Set oRootDSE = GetObject("LDAP://rootDSE") Set oConnection = CreateObject("ADODB.Connection") oConnection.Open "Provider=ADsDSOObject;" Set oCommand = CreateObject("ADODB.Command") oCommand.ActiveConnection = oConnection oCommand.CommandText = "<LDAP://" & oRootDSE.get("defaultNamingContext") & ">;(&(objectCategory=User)(samAccountName=" & vSAN & "));distinguishedName;subtree" Set oRecordSet = oCommand.Execute On Error Resume Next SearchDistinguishedName = oRecordSet.Fields("DistinguishedName") On Error GoTo 0 oConnection.Close Set oRecordSet = Nothing Set oCommand = Nothing Set oConnection = Nothing Set oRootDSE = Nothing End Function

    Read the article

  • how do I access XHR responseBody from Javascript?

    - by Cheeso
    I've got a web page that uses XMLHttpRequest to download a binary resource. Because it's binary I'm trying to use xhr.responseBody to access the bytes. I've seen a few posts suggesting that it's impossible to access the bytes directly from Javascript. This sounds crazy to me. Weirdly, xhr.responseBody is accessible from VBScript, so the suggestion is that I must define a method in VBScript in the webpage, and then call that method from Javascript. See jsdap for one example. var IE_HACK = (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)); if (IE_HACK) document.write('<script type="text/vbscript">\n\ Function BinaryToArray(Binary)\n\ Dim i\n\ ReDim byteArray(LenB(Binary))\n\ For i = 1 To LenB(Binary)\n\ byteArray(i-1) = AscB(MidB(Binary, i, 1))\n\ Next\n\ BinaryToArray = byteArray\n\ End Function\n\ </script>'); var xml = (window.XMLHttpRequest) ? new XMLHttpRequest() // Mozilla/Safari/IE7+ : (window.ActiveXObject) ? new ActiveXObject("MSXML2.XMLHTTP") // IE6 : null; // Commodore 64? xml.open("GET", url, true); if (xml.overrideMimeType) { xml.overrideMimeType('text/plain; charset=x-user-defined'); } else { xml.setRequestHeader('Accept-Charset', 'x-user-defined'); } xml.onreadystatechange = function() { if (xml.readyState == 4) { if (!binary) { callback(xml.responseText); } else if (IE_HACK) { // call a VBScript method to copy every single byte callback(BinaryToArray(xml.responseBody).toArray()); } else { callback(getBuffer(xml.responseText)); } } }; xml.send(''); Is this really true? The best way? copying every byte? For a large binary stream that's not gonna be very efficient. There is also a possible technique using ADODB.Stream, which is a COM equivalent of a MemoryStream. See here for an example. It does not require VBScript but does require a separate COM object. if (typeof (ActiveXObject) != "undefined" && typeof (httpRequest.responseBody) != "undefined") { // Convert httpRequest.responseBody byte stream to shift_jis encoded string var stream = new ActiveXObject("ADODB.Stream"); stream.Type = 1; // adTypeBinary stream.Open (); stream.Write (httpRequest.responseBody); stream.Position = 0; stream.Type = 1; // adTypeBinary; stream.Read.... /// ???? what here } I don't think that's gonna work - ADODB.Stream is disabled on most machines these days. In The IE8 developer tools - the IE equivalent of Firebug - I can see the responseBody is an array of bytes and I can even see the bytes themselves. The data is right there. I don't understand why I can't get to it. Is it possible for me to read it with responseText? hints? (other than defining a VBScript method)

    Read the article

  • ADO program to list members of a large group.

    - by AlexGomez
    Hi everyone, I'm attempting to list all the members in a Active Directory group using ADO. The problem I have is that many of these groups have over 1500 members and ADSI cannot handle more than 1500 items in a multi-valued attribute. Fortunately I came across Richard Muller's wonderful VBScript that handles more than 1500 members at http://www.rlmueller.net/DocumentLargeGroup.htm I modified his code as shown below so that I can list ALL the groups and its memberships in a certain OU. However, I'm keeping getting the exception shown below: "ADODB.Recordset: Item cannot be found in the collection corresponding to the requested name or ordinal." My program appears to get stuck at: strPath = adoRecordset.Fields("ADsPath").Value Set objGroup = GetObject(strPath) All I am doing above is issuing the query to get back a recordset consisting of the ADsPath for each group in the OU. It then walks through the recordset and grabs the ADsPath for the first group and store its in a variable named strPath; we then use the value of that variable to bind to the group account for that group. It really should work! Any idea why the code below doesn't work for me? Any pointers will be great appreciated. Thanks. Option Explicit Dim objRootDSE, strDNSDomain, adoCommand Dim adoConnection, strBase, strAttributes Dim strFilter, strQuery, adoRecordset Dim strDN, intCount, blnLast, intLowRange Dim intHighRange, intRangeStep, objField Dim objGroup, objMember, strName ' Determine DNS domain name. Set objRootDSE = GetObject("LDAP://RootDSE") 'strDNSDomain = objRootDSE.Get("DefaultNamingContext") strDNSDomain = "XXXXXXXX" ' Use ADO to search Active Directory. Set adoCommand = CreateObject("ADODB.Command") Set adoConnection = CreateObject("ADODB.Connection") adoConnection.Provider = "ADsDSOObject" adoConnection.Open = "Active Directory Provider" adoCommand.ActiveConnection = adoConnection adoCommand.Properties("Page Size") = 100 adoCommand.Properties("Timeout") = 30 adoCommand.Properties("Cache Results") = False ' Specify base of search. strBase = "<LDAP://" & strDNSDomain & ">" ' Specify the attribute values to retrieve. strAttributes = "member" ' Filter on objects of class "group" strFilter = "(&(objectClass=group)(samAccountName=*))" ' Enumerate direct group members. ' Use range limits to handle more than 1000/1500 members. ' Setup to retrieve 1000 members at a time. blnLast = False intRangeStep = 999 intLowRange = 0 IntHighRange = intLowRange + intRangeStep Do While True If (blnLast = True) Then ' If last query, retrieve remaining members. strQuery = strBase & ";" & strFilter & ";" _ & strAttributes & ";range=" & intLowRange _ & "-*;subtree" Else ' If not last query, retrieve 1000 members. strQuery = strBase & ";" & strFilter & ";" _ & strAttributes & ";range=" & intLowRange & "-" _ & intHighRange & ";subtree" End If adoCommand.CommandText = strQuery Set adoRecordset = adoCommand.Execute adoRecordset.MoveFirst intCount = 0 Do Until adoRecordset.EOF strPath = adoRecordset.Fields("ADsPath").Value Set objGroup = GetObject(strPath) For Each objField In adoRecordset.Fields If (VarType(objField) = (vbArray + vbVariant)) _ Then For Each strDN In objField.Value ' Escape any forward slash characters, "/", with the backslash ' escape character. All other characters that should be escaped are. strDN = Replace(strDN, "/", "\/") ' Check dictionary object for duplicates. 'If (objGroupList.Exists(strDN) = False) Then ' Add to dictionary object. 'objGroupList.Add strDN, True ' Bind to each group member, to find member's samAccountName Set objMember = GetObject("LDAP://" & strDN) ' Output group cn, group samaAccountName and group member's samAccountName. Wscript.Echo objMember.samAccountName intCount = intCount + 1 'End if Next End If Next adoRecordset.MoveNext Loop adoRecordset.Close ' If this is the last query, exit the Do While loop. If (blnLast = True) Then Exit Do End If ' If the previous query returned no members, then the previous ' query for the next 1000 members failed. Perform one more ' query to retrieve remaining members (less than 1000). If (intCount = 0) Then blnLast = True Else ' Setup to retrieve next 1000 members. intLowRange = intHighRange + 1 intHighRange = intLowRange + intRangeStep End If Loop

    Read the article

  • Pivotcache problem using ado recordset into excel

    - by bbenton
    I'm having a problem with runtime error 1004 at the last line. I'm bringing in an access query into excel 2007. I know the recordset is ok as I can see the fields and data. Im not sure about the picotcache was created in the set ptCache line. I see the application, but the index is 0. Code is below... Private Sub cmdPivotTables_Click() Dim rs As ADODB.Recordset Dim i As Integer Dim appExcel As Excel.Application Dim wkbTo As Excel.Workbook Dim wksTo As Excel.Worksheet Dim str As String Dim strSQL As String Dim rng As Excel.Range Dim rs As DAO.Recordset Dim db As DAO.Database Dim ptCache As Excel.PivotCache Set db = CurrentDb() 'to handle case where excel is not open On Error GoTo errhandler: Set appExcel = GetObject(, "Excel.Application") 'returns to default excel error handling On Error GoTo 0 appExcel.Visible = True str = FilePathReports & "Reports SCU\SCCUExcelReports.xlsx" 'tests if the workbook is open (using workbookopen functiion) If WorkbookIsOpen("SCCUExcelReports.xlsx", appExcel) Then Set wkbTo = appExcel.Workbooks("SCCUExcelReports.xlsx") wkbTo.Save 'To ensure correct Ratios&Charts is used wkbTo.Close End If Set wkbTo = GetObject(str) wkbTo.Application.Visible = True wkbTo.Parent.Windows("SCCUExcelReports.xlsx").Visible = True Set rs = New ADODB.Recordset strSQL = "SELECT viewBalanceSheetType.AccountTypeCode AS Type, viewBalanceSheetType.AccountGroupName AS AccountGroup, " _ & "viewBalanceSheetType.AccountSubGroupName As SubGroup, qryAmountIncludingAdjustment.BranchCode AS Branch, " _ & "viewBalanceSheetType.AccountNumber, viewBalanceSheetType.AccountName, " _ & "qryAmountIncludingAdjustment.Amount, qryAmountIncludingAdjustment.MonthEndDate " _ & "FROM viewBalanceSheetType INNER JOIN qryAmountIncludingAdjustment ON " _ & "viewBalanceSheetType.AccountID = qryAmountIncludingAdjustment.AccountID " _ & "WHERE (qryAmountIncludingAdjustment.MonthEndDate = GetCurrent()) " _ & "ORDER BY viewBalanceSheetType.AccountTypeSortOrder, viewBalanceSheetType.AccountGroupSortOrder, " _ & "viewBalanceSheetType.AccountNumber;" rs.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic ' Set rs = db.OpenRecordset("qryExcelReportsTrialBalancePT", dbOpenForwardOnly) **'**********problem here Set ptCache = wkbTo.PivotCaches.Create(SourceType:=XlPivotTableSourceType.xlExternal) Set wkbTo.PivotCaches("ptCache").Recordset = rs**

    Read the article

  • Adding new record to a VFP data table in VB.NET with ADO recordsets

    - by Gerry
    I am trying to add a new record to a Visual FoxPro data table using an ADO dataset with no luck. The code runs fine with no exceptions but when I check the dbf after the fact there is no new record. The mDataPath variable shown in the code snippet is the path to the .dbc file for the entire database. A note about the For loop at the bottom; I am adding the body of incoming emails to this MEMO field so thought I needed to break the addition of this string into 256 character Chunks. Any guidance would be greatly appreciated. cnn1.Open("Driver={Microsoft Visual FoxPro Driver};" & _ "SourceType=DBC;" & _ "SourceDB=" & mDataPath & ";Exclusive=No") Dim RS As ADODB.RecordsetS = New ADODB.Recordset RS.Open("select * from gennote", cnn1, 1, 3, 1) RS.AddNew() 'Assign values to the first three fields RS.Fields("ignnoteid").Value = NextIDI RS.Fields("cnotetitle").Value = "'" & mail.Subject & "'" RS.Fields("cfilename").Value = "''" 'Looping through 254 characters at a time and add the data 'to Ado Field buffer For i As Integer = 1 To Len(memo) Step liChunkSize liStartAt = i liWorkString = Mid(mail.Body, liStartAt, liChunkSize) RS.Fields("mnote").AppendChunk(liWorkString) Next 'Update the recordset RS.Update() RS.Requery() RS.Close()

    Read the article

  • Import Excel 2007 into SQL 2000 using Classic ASP and ADO

    - by jeff
    I have the following code from a legacy app which currently reads from an excel 2003 spreadsheet on a server, but I need this to run from my machine which uses excel 2007. When I debug on my machine ADO does not seem to be reading the spreadsheet. I have checked all file paths etc. and location of spreadsheet that is all fine. I've heard that you cannot use the jet db engine for excel 2007 anymore? Can someone confirm this? What do I need to do to get this to work? Please help! set obj_conn = Server.CreateObject("ADODB.Connection") obj_conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Application("str_folder") & "CNS43.xls;" & _ "Extended Properties=""Excel 8.0;""" set obj_rs_cns43 = Server.CreateObject("ADODB.RecordSet") obj_rs_cns43.ActiveConnection = obj_conn obj_rs_cns43.CursorType = 3 obj_rs_cns43.LockType = 2 obj_rs_cns43.Source = "SELECT * FROM [CNS43$]" obj_rs_cns43.Open

    Read the article

  • VB.net (aspx) mysql connection

    - by StealthRT
    Hey all i am new to ASP.NET and VB.net code behind. I have a classic ASP page that connects to the mySQL server with the following code: Set oConnection = Server.CreateObject("ADODB.Connection") Set oRecordset = Server.CreateObject("ADODB.Recordset") oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=xxx.com; PORT=3306; DATABASE=xxx; USER=xxx; PASSWORD=xxx; OPTION=3;" sqltemp = "select * from userinfo WHERE emailAddress = '" & theUN & "'" oRecordset.Open sqltemp, oConnection,3,3 if oRecordset.EOF then ... However, i am unable to find anything to connect to mySQL in ASP.NET (VB.NET). I have only found this peice of code that does not seem to work once it gets to the "Dim conn As New OdbcConnection(MyConString)" code: Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=xxx.com;" & _ "DATABASE=xxx;" & _ "UID=xxx;" & _ "PASSWORD=xxx;" & _ "OPTION=3;" Dim conn As New OdbcConnection(MyConString) MyConnection.Open() Dim MyCommand As New OdbcCommand MyCommand.Connection = MyConnection MyCommand.CommandText = "select * from userinfo WHERE emailAddress = '" & theUN & "'"" MyCommand.ExecuteNonQuery() MyConnection.Close() I have these import statements also: <%@ Import Namespace=System %> <%@ Import Namespace=System.IO %> <%@ Import Namespace=System.Web %> <%@ Import Namespace=System.ServiceProcess %> <%@ Import Namespace=Microsoft.Data.Odbc %> <%@ Import Namespace=MySql.Data.MySqlClient %> <%@ Import Namespace=MySql.Data %> <%@ Import Namespace=System.Data %> So any help would be great! :o) David

    Read the article

  • oRecordset in ASP.NET mySQL problem

    - by StealthRT
    I have this mySQL code that connects to my server. It connects just fine: Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=xxx.com;" & _ "DATABASE=xxx;" & _ "UID=xxx;" & _ "PASSWORD=xxx;" & _ "OPTION=3;" Dim conn As OdbcConnection = New OdbcConnection(MyConString) conn.Open() Dim MyCommand As New OdbcCommand MyCommand.Connection = conn MyCommand.CommandText = "select * from userinfo WHERE emailAddress = '" & theUN & "'"" MyCommand.ExecuteNonQuery() conn.Close() However, i have an old Classic ASP page that uses "oRecordset" to get the data from the mySQL server: Set oConnection = Server.CreateObject("ADODB.Connection") Set oRecordset = Server.CreateObject("ADODB.Recordset") oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=xxx.com; PORT=3306; DATABASE=xxx; USER=xxx; PASSWORD=xxx; OPTION=3;" sqltemp = "select * from userinfo WHERE emailAddress = '" & theUN & "'" oRecordset.Open sqltemp, oConnection,3,3 And i can use oRecordset as follows: if oRecordset.EOF then.... or strValue = oRecordset("Table_Name").value or oRecordset("Table_Name").value = "New Value" oRecordset.update etc... However, for the life of me, i can not find any .net code that is simular to that of my Classic ASP page!!!!! Any help would be great! :o) David

    Read the article

  • How do I associate Parameters to Command objects in ADO with VBScript?

    - by Krashman5k
    I have been working an ADO VBScript that needs to accept parameters and incorporate those parameters in the Query string that gets passed the the database. I keep getting errors when the Record Set Object attempts to open. If I pass a query without parameters, the recordset opens and I can work with the data. When I run the script through a debugger, the command object does not show a value for the parameter object. It seems to me that I am missing something that associates the Command object and Parameter object, but I do not know what. Here is a bit of the VBScript Code: ... 'Open Text file to collect SQL query string' Set fso = CreateObject("Scripting.FileSystemObject") fileName = "C:\SQLFUN\Limits_ADO.sql" Set tso = fso.OpenTextFile(fileName, FORREADING) SQL = tso.ReadAll 'Create ADO instance' connString = "DRIVER={SQL Server};SERVER=myserver;UID=MyName;PWD=notapassword; Database=favoriteDB" Set connection = CreateObject("ADODB.Connection") Set cmd = CreateObject("ADODB.Command") connection.Open connString cmd.ActiveConnection = connection cmd.CommandText = SQL cmd.CommandType = adCmdText Set paramTotals = cmd.CreateParameter With paramTotals .value = "tot%" .Name = "Param1" End With 'The error occurs on the next line' Set recordset = cmd.Execute If recordset.EOF then WScript.Echo "No Data Returned" Else Do Until recordset.EOF WScript.Echo recordset.Fields.Item(0) ' & vbTab & recordset.Fields.Item(1) recordset.MoveNext Loop End If The SQL string that I use is fairly standard except I want to pass a parameter to it. It is something like this: SELECT column1 FROM table1 WHERE column1 IS LIKE ? I understand that ADO should replace the "?" with the parameter value I assign in the script. The problem I am seeing is that the Parameter object shows the correct value, but the command object's parameter field is null according to my debugger.

    Read the article

  • How to access SQL CE 3.5 from VB6

    - by Masterfu
    We have a .NET 3.5 SP1 application written in C# that stores data in an SQL CE 3.5 Database. We also need to access (read only) this very data from a legacy VB6 application. I don't know if this is at all possible. There are several approaches to this problem that I can think of. 1) I have read about ADOCE Connections, but this seems to be an option for embedded Visual Basic only 2) I can't seem to get a connection working using ADODB.Connection Objects like so Dim MyConnObj As New ADODB.Connection ' Microsoft.SQLSERVER.CE.OLEDB.3.5 ' Microsoft.SQLSERVER.MOBILE.OLEDB.3.0 MyConnObj.ConnectionString = "Provider=SQLOLEDB;Data Source=c:\test.sdf" MyConnObj.Open Maybe this is just a bad choice of providers? I also tried the providers that appear as comments above and different connection strings, but to no avail. Both providers are not installed on my dev machine and won't be installed on my customer's machine. 3) Maybe there is a way to use a more generic approach like ODBC? But I believe this would result in setup / deployment work, right? Does anyone have any experience with this scenario? As you can see, I am really looking for some good starting points. I also accept answers like "This is drop dead simple and so are you" as long as they come with some guiding directions ;-)

    Read the article

  • SQL UNION ALL problem after using UNION ALL more than 10 times

    - by VBGKM
    I'm getting a formatting problem if I use more than 10 UNION ALL statements in my VBA Code. If I use 10 or less everything works great. What I'm trying to do is combine 12 worksheets (Excel 2007). I have a numerical column called SC that turns into string and date if I have more than 10 UNION ALL. If I try to use ROUND with more than 10 UNION ALL my last selection will change all the records by one unit. I'm using Microsoft.ACE.OLEDB.12.0 as my provider and my connection string has worked for several things in my code so far. Is there any limit for UNION ALL statements when using OLEDB? Here is my code. Dim StrOr As String Dim i As Variant Dim Cnt As ADODB.Connection Dim Rs As ADODB.Recordset For i = 1 To 12 StrOr = StrOr & " " & "SELECT SC FROM [" & MonthName(i, True) & "$" & "] UNION ALL" Next StrOr = Left(StrOr, Len(StrOr) - 9) & ";" Call GetADOCnt Call ADORs

    Read the article

  • Upload An Excel File in Classic ASP On Windows 2003 x64 Using Office 2010 Drivers

    - by alphadogg
    So, we are migrating an old web app from a 32-bit server to a newer 64-bit server. The app is basically a Classic ASP app. The pool is set to run in 64-bit and cannot be set to 32-bit due to other components. However, this breaks the old usage of Jet drivers and subsequent parsing of Excel files. After some research, I downloaded the 64-bit version of the new 2010 Office System Driver Beta and installed it. Presumably, this allows one to open and read Excel and CSV files. Here's the snippet of code that errors out. Think I followed the lean guidelines on the download page: Set con = Server.CreateObject("ADODB.Connection") con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.14.0;Data Source=" & strPath & ";Extended Properties=""Excel 14.0;""" con.Open Any ideas why? UPDATE: My apologies. I did forget the important part, the error message: ADODB.Connection error '800a0e7a' Provider cannot be found. It may not be properly installed. /vendor/importZipList2.asp, line 56 I have installed, and uninstalled/reinstalled twice.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >