Help on Connection error!

Results 1 to 2 of 2

Thread: Help on Connection error!

  1. #1
    Join Date
    Dec 1969

    Default Help on Connection error!

    Hello,<BR><BR>I am using ASP to access a COM written in VB and I&#039;m getting the following error message:<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80004005)<BR>[Microsoft][ODBC SQL Server Driver][Named Pipes]Invalid connection.<BR>/StockNet/UpdateGBCOM.asp, line 51<BR><BR>Can you help me figure out what&#039;s wrong.<BR><BR>Thanks,<BR><BR>ASP CODE<BR>********<BR><BR>&#039; Set Parameters<BR> rIDA=Request.QueryString("recordid")<BR> AccountNum = session("user")<BR><BR> &#039; Select Record from StockNet<BR> Set var7 = CreateObject("GBCls3.GBOrderDir3")<BR> Set var8 = var7.GetSNRecords(rIDA, AccountNum)<BR> var8.Open<BR><BR>COM<BR>***<BR><BR>Public Function GetSNRecords(rIDA, AccountNum) As ADODB.recordset<BR> &#039;SETTING MTS OBJECT<BR> Dim objOContext As ObjectContext<BR> Set objOContext = GetObjectContext()<BR> <BR> &#039;SET ADO OBJECTS<BR> Dim objConn As New ADODB.connection<BR> Dim objRS As New ADODB.recordset<BR> Dim objCommand As New ADODB.Command<BR> Dim objParam As New ADODB.Parameter<BR> <BR> &#039;OPEN DATABASE CONNECTION<BR> With objConn<BR> .ConnectionString = DB_CONNECTIONSTRING_GB<BR> .Open<BR> End With<BR> <BR> &#039; USE COMMAND OBJECT TO CALL STORED PROCEDURE<BR> With objCommand<BR> .CommandText = "GetSNRecord"<BR> .CommandType = adCmdStoredProc<BR> .ActiveConnection = objConn<BR> End With<BR> <BR> &#039; PASS RECORDID AND ACCOUNTNUMBER TO STORED PROCEDURE<BR> Set objParam = objCommand.CreateParameter("@RecordIDA", adVarChar, adParamInput, 6, rIDA)<BR> objCommand.Parameters.Append objParam<BR> Set objParam = objCommand.CreateParameter("@AccountNumber", adVarChar, adParamInput, 9, AccountNum)<BR> objCommand.Parameters.Append objParam<BR> Set objRS = objCommand.Execute<BR> <BR> &#039;SET FUNCTION (GetSNRecords)EQUAL TO RECORDSET OBJECT (objRS)<BR> Set GetSNRecords = objRS<BR> objRS.Close<BR>End Function<BR><BR>Stored Procedure<BR>****************<BR>CREATE PROCEDURE GetSNRecord<BR><BR>@RecordIDA varchar(6),<BR>@AccountNumber varchar(9)<BR><BR> AS<BR><BR>DECLARE @Return int,<BR> @TranCnt tinyint<BR><BR><BR> <BR>SELECT @TranCnt = @@TRANCOUNT<BR> <BR>IF @TranCnt = 0<BR>BEGIN TRAN -- Only begin tran when trancount is 0 to avoid rolling back to wrong tran at nested tran<BR><BR><BR>Select * from SNOrderEntry where RecordIDA = RTRIM(@RecordIDA) and SNCustomerAccNum = RTRIM(@AccountNumber)<BR>order by CurrentDate<BR><BR>SELECT @Return = @@ERROR<BR><BR>IF @TranCnt = 0<BR> IF @Return = 0 COMMIT TRAN<BR> ELSE ROLLBACK TRAN<BR><BR>RETURN @Return<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default you're using a DSN, right?

    i reckon the DSN is trying to use named pipes to connect, whereas the server isn&#039;t configured for named pipes. try using an OLEDB connection string instead - it&#039;s easier.

Posting Permissions

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