Receive Adodb.Recordset From MSMQ?

Feb 6, 2008

I've been trying different things to "READ" the recordset from the "Message Queue". I can read it but with some weird characters. I've tried

ActiveXMessageFormatter

BinaryMessageFormatter

XMLMessageFormatter


So, far I have no luck.

MessageQueue msgQ3 = new MessageQueue("SERVERNM\" + msg.Label, false);

Message msg3 = new Message();

msg3.Formatter = new ActiveXMessageFormatter();
msg3 = msgQ3.Receive(new TimeSpan(0, 0, 30));

byte[] b = new byte[msg3.BodyStream.Length];
msg3.BodyStream.Read(b, 0, (int)msg3.BodyStream.Length); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();

returnVal = enc.GetString(b);



RESULTS:
I try to convert it to String and then deserialize later but I'm getting some junk.
<?xml version="1.0" encoding="utf-8" ?>

<string xmlns="http://tempuri.org/">5??m.????????#?_?XTG!???????#?_?Xg??c??????? ?<???m????_?X  |?"???????Dw=?????"I?<???m????_?X21? Reply_Code?$??5? MultiEntries?$??7?dName?.$??3? Page_Number?$??1? Number?$??3? Status_Code?$??/?_Name?.$??5? _Address?+$??/? B_City?$$??1? _State?$??-? _Zip?$??A? Bank_Telephone_Num?"$?? ??11  033000333YHONDA2nd street xavier VA 326200000(555) 555-5500</string>

View 1 Replies


ADVERTISEMENT

Script Component Has Encountered An Exception In User Code - Object Is Not An ADODB.RecordSet Or An ADODB.Record

Nov 26, 2007

hi have written SSIS script and i am using script component to Row count below my code what i have written. and i am getting error below i have mention...after code see the error
using System;

using System.Data;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using System.Data.SqlClient;

using System.Data.OleDb;



[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]

public class ScriptMain : UserComponent

{

IDTSConnectionManager100 connMgr;

OleDbConnection sqlConn = null;

OleDbDataReader sqlReader;



public override void AcquireConnections(object Transaction)

{

connMgr = this.Connections.MyConnection;

sqlConn = (OleDbConnection )connMgr.AcquireConnection(null);

//sqlConn = (SqlConnection)connMgr.AcquireConnection(null);

}

public override void PreExecute()

{

base.PreExecute();

/*

Add your code here for preprocessing or remove if not needed

*/

OleDbCommand cmd = new OleDbCommand("SELECT CustomerID,TerritoryID,AccountNumber,CustomerType FROM Sales.Customer", sqlConn);



sqlReader = cmd.ExecuteReader();

}

public override void PostExecute()

{

base.PostExecute();

/*

Add your code here for postprocessing or remove if not needed

You can set read/write variables here, for example:

Variables.MyIntVar = 100

*/

}

public override void CreateNewOutputRows()

{

/*

Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".

For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".

*/

System.Data.OleDb.OleDbDataAdapter oLead = new System.Data.OleDb.OleDbDataAdapter();

//SqlDataAdapter oLead = new SqlDataAdapter();

DataSet ds = new DataSet();



System.Data.DataTable dt = new System.Data.DataTable();

//DataRow row = new DataRow();

oLead.Fill(dt,this.Variables.ObjVariable);





foreach (DataRow row in dt.Rows)

{

{

Output0Buffer.AddRow();

Output0Buffer.CustomerID = (int)row["CustomerID"];

Output0Buffer.TerritoryID =(int)row["TerritoryID"];

Output0Buffer.AccountNumber = row["AccountNumber"].ToString();

Output0Buffer.CustomerType = row["CustomerType"].ToString();

}

}



}

}
the error
Script component has encountered an exception in user code
Object is not an ADODB.RecordSet or an ADODB.Record.
Parameter name: adodb
at System.Data.OleDb.OleDbDataAdapter.FillFromADODB(Object data, Object adodb, String
srcTable, Boolean multipleResults)
at System.Data.OleDb.OleDbDataAdapter.Fill(DataTable dataTable, Object ADODBRecordSet)
at ScriptMain.CreateNewOutputRows()
at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs,
Int32[] outputIDs, PipelineBuffer[] buffers)

thanks
kedarnath

View 4 Replies View Related

Adodb Recordset Problem

Mar 31, 2006

I am trying to access a table that I know exists and has data. But, when I create a recordset and check for RecordCount, I get a result -1 (no records). When I access the same table (using the same program), it reports (and I can view in a dbgrid) 752580 records exist.

Here's some of the code:

The table is originally copied from another database; I use the following code to be sure the previous connection is closed before proceeding.

  If Not adoRS Is Nothing Then
    If adoRS.State = adStateOpen Then adoRS.Close
    Set adoRS = Nothing
  End If
  If Not DbConn Is Nothing Then
    If DbConn.State = adStateOpen Then DbConn.Close
    Set DbConn = Nothing
  End If

Then a new connection (it works) is opened to access the database with the  copied table:

   strDbConn = "Provider=SQLNCLI;Integrated Security=SSPI;" & _
  "Persist Security Info=False;Database=" & strDbName & ";" & _
  "AttachDBFileName=" & DbPath & ";Data Source=.sqlexpress;" & _
  "User Instance=True"

Next I tried to create the recordset:

  Set adoNewRS = New ADODB.Recordset 'Set OHLC recordset
  Set adoNewRS.ActiveConnection = DestDbConn
  adoNewRS.Open TableName, DestDbConn, adOpenDynamic, adLockOptimistic

Next I try to get the RecordCount:

  NumRecords = adoNewRS.RecordCount

At this point, NumRecords (and adoNewRS.RecordCount) = -1 (even tho I know there are 752580 records in the table).

In the adoNewRS.Open statement, I also tried using the following sql statement:

sSQL = "SELECT * FROM TableName ORDER BY [DateTime];"

It also returns a recordcount = -1.

Anybody have clue?

View 1 Replies View Related

Read Table Description Into ADODB.Recordset.

Aug 20, 2003

How do I read the Tables description into ADODB.Recordset and then recreate the Tables+description into a new database from the ADODB.Recordset.

View 1 Replies View Related

Could I Use SQL Select Case .. When... In ADODB.Recordset().open

Jul 20, 2005

Is there any SQL Error?Or I have to use Select case in VB code to control SQL instead.Thank you for any ans.Nuno

View 4 Replies View Related

Script Task: ADODB Connection And Recordset

Jul 19, 2006

Hi,

I used adodb connection and recordset in script task. but i have an error saying adodb is not defined. how do i add it to reference? or, is adodb can run in script task or only ado.net?

cherrie

View 2 Replies View Related

Temporary Tables Adodb Recordset Error

Feb 23, 2008

Hi,

I am using the following code


I use SQLOLEDB Provider
It is not stored porcedure but program code

create new global temporary table with
CREATE TABLE ##tmp123 (...
create and open a recorsset to populate it as direct table
at the open stage I get the following error: Invalid object name '##tmp123'

How can I get it working?

View 2 Replies View Related

Vista ADODB Recordset Can't Create ActiveX Object

Jul 19, 2007

Somehow, (I think the user ran a registry cleaner) on Vista, I can no longer create an adodb recordset object.



The app is a VB6 app that works fine on my own Vista Ultimate, my XP boxes and about everthing else prior, but not on the one Vista Home Premium.



I get Error 429 ... Cannot Create ActiveX Object when creating a new adodb.recordset object.



I guess what I need is a way to repair the Vista Home-P machine without having to wipe it.



I see that MDAC_Typ is not recommended as a fix.



I'm at a loss on this one.



View 3 Replies View Related

Unable To Cast COM Object Of Type 'ADODB.CommandClass' To Interface Type 'ADODB._Command'

Dec 20, 2006

I have an application which runs successfully on a couple of my customer's machines but fails on a third. It seems to fail when opening the database:

Unable to cast COM object of type 'ADODB.CommandClass' to interface type 'ADODB._Command'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B08400BD-F9D1-4D02-B856-71D5DBA123E9}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=false; Initial Catalog=lensdb;Data Source = SQL

Before I got this error I was getting another problem (sorry didn't make a copy of that error's text) that made me think that adodb.dll simply wasn't loaded/registered. I got rid of that error by copying my adodb.dll onto the third machine and running gacutil /i. There is now an entry in winntassemblies for adodb.

Just in case you think it could be an obvious registry problem: when I started getting the current error I thought that maybe the registry needed updating and I merged the following lines into onto the target machine (from my dev machine):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}]
@="_Command"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}TypeLib]
@="{EF53050B-882E-4776-B643-EDA472E8E3F2}"
"Version"="2.7"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}]
@="_Command"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}TypeLib]
@="{EF53050B-882E-4776-B643-EDA472E8E3F2}"
"Version"="2.7"


but, no change alas.

All three machines are running Windows 2000.

Any advice would be appreciated.

Thanks in advance,

Ross

View 1 Replies View Related

MSMQ

Nov 28, 2006

Does anyone know or have any idea what's the use of msmq or how can this apply in ssis.

Thanks

View 5 Replies View Related

MSMQ SSB WCF?

Jun 27, 2007

I've an asp.net application that generates tons of messages (a few hundreds/Second, depending on load of requests). Basically, I need to consume those messages (doesn't have to call "message" even) into sql server table. Each message being a new row in a table.



I tried a few things but failed to satisfy the performance. I tried to put the messages in MSMQ and then have either the MSMQ trigger to process the message or Windows C# service to process message. The performance is horrible.



I'm thinking to send messages directly to SSBQueue and have sql server process it. Is there any async way of doing this so the performance would not be a problem? Anyway I can use WCF + SSB to solve this problem?



Can anybody suggest better approach? Buying a decent hardware or SQL Server 2005 is not a problem.



Rushi, if you are reading this post, sorry for the repeatation, I know I emailed you a few hours ago...



Thanks.

View 4 Replies View Related

Does MSMQ 1.0 Work With SQL 7?

Feb 15, 1999

Does MSMQ 1.0 work with SQL 7?

MSMQ requires SQL Server. It works with SQL 6.5.

View 1 Replies View Related

SQL Service Broker Vs MSMQ

Aug 23, 2006

I'm in the process of doing the initial research for the architecture of a large scale, transactional messages routing platform.

My initial
design called for a series of MSMQ queues and Windows Services, written
in C#, to process the messages in these queues. There will be incoming
and outgoing queues, queues to store unroutable messages, etc.

My
application will be routing many hundreds of thousands (and eventually
millions) of messages per day. These message are very small (< 200
bytes each) and must be routed very quickly. (<1 second processing overhead per message for high priority messages.)

Using the term
"routing" may be a bit misleading. The messages arrive via TCP socket
connections. I will just need to take in a message, examine its
intended destination, and send it to one of several outgoing socket
connections, likely on different machines. Some messages require higher priority routing than others,
but I don't need multi-hop routing or anything like that.

Of
great concern to me is that there are absolutely no single points of
failure in the system. Because of this I was considering using a combination of MSMQ and Windows Services in a Clustered environment.

Can the Service Broker provide me with this kind of functionality? If so, how well does it perform and scale? Is it a better choice for messaging applications that require high transactional throughput than MSMQ?

I'm just trying to get an idea of what products/services I should look into further.

View 15 Replies View Related

Two Phase Commit With Sql And Msmq

Jul 3, 2006

Doe's anyone have a good article on it ?



Thanks

Avi

View 1 Replies View Related

MSMQ &&amp; Integration Services

Feb 6, 2006

I have a SSIS package in SQL Server 2005 that attempts to publish some data into a MSMQ Private queue located on another machine.

While I was creating the package the connection string was pointing to the local server something like: localhostprivate$csin

Now I'm trying to get to the remote machine but I'm not sure what type of connection string I need to enter:



I tried: mw59private$csin where mw59 is the name of the remote machine I need to publish to but that result into a "Invalid Queue Path Name."



I tried: formatname:DIRECT=OS:mw59private$csin but that results in "The specified format name does not support the requested operation...."

Any idea?



Thanks,



Thierry

View 4 Replies View Related

Call Stored Procedure From MSMQ Message

Nov 28, 2007

Does anyone have any ideas or sample code for firing a stored procedure using an MSMQ message?

I have to assume XML is in there somewhere.
(ie. create XML formatted message with proc call as element?)

Just getting started on project, any help appreciated.


www.beyonder422.com

View 4 Replies View Related

MSMQ Export List Of The Public Queue

Jan 2, 2008



Hi,

I want to Export a List of the Public Queues using the command prompt. Can this be done. I don't want to always click the Export List button. I eventually want to automate the Export List so I can create an Environment HealthCheck.

Thanks

View 1 Replies View Related

Msmq Missing Messages After Applying SP3a To SQL Server

Jan 12, 2004

Used to work fine:
(windows 200 server, sql server 2000, JDBC driver SP2.)
Two java processes, one sending messages (using jdbc and sql as temp storage), second is receiving and placing on msmq.

After installing SP3a for SQL server, under high load (200 a sec) there are missing messages in msmq.
Installed everything from scratch on separate machine, works fine until SP3a is applied.
Any help is highly appreciated

View 3 Replies View Related

MSMQ Connection Manager And Input Into A Data Flow

Apr 13, 2006

Firstly the disclaimer: im a total SSIS bunny.
Ok, with that out of the way...
What i want to do is have data read from an MSMQ message (which will be a simple XML message) and have it transformed and inserted into a simple table. Sound simple, but i cant work out how to do it.

I started a new Integration Services Project and dropped a Data Flow task on the Control flow tab, then double-click it to go to the data flow tab. I have added a MSMQ connection manager which points at my private queue and i can hit the test button and it sees it tests ok. How do i wire that into my data flow?

On my dataflow tab i have a SQL Server Destination (set to the local SQl server instance) and ive been trying a DataReader source and try setting the Advanced Editor "Connection Manager" column on IDBConnection row to point to my MSMQ connection manager. I get some error "cannot aquire a managed connection from the run-time connection manager". How do i get a Data Flow source which reads the XML message off my MSMQ connection manager??

On the Control Flow tab you can add a Message Queue Task and i can bind it to my MSMQ connection manager and set it up as a recieve task etc, but how do i use that?

Help!

View 3 Replies View Related

MSMQ Or Service Broker For Mission Critical Applications

Nov 30, 2007

Hello,

I'm working on the design of a system that will have two queues. The first queue will take requests to do something. The second queue will hold the results of having done something. Both queues won't necessarily be on the same physical server. Clients reading/writing to the queue will not be using SQL server. Web service/WCF interfaces will be developed to interrogate/manipulate queues.

My question is: which is better - MSMQ or Service Broker; if I want reliable queues. I can affort to loose items off the first queue, but cannot afford to loose any result data on the second queue.

Can anyone make any recommendations please?

Regards,
Jonathan.

View 3 Replies View Related

SSIS Writing To MSMQ Fails Only When Scheduled By Agent Job

Feb 12, 2008



Hi All,

I'm a bit lost on this...

I have an SSIS package which writes to a configured public MSMQ. When run directly through Visual Studio, file system or msdb it works fine (I guess these use me as the user).
However, when I schedule it through an SQL Agent Job it fails with the following:

Failed to write message ... to the queue.

This seems like a permissions thing to me, but I've tried giving full control to everyone in the MSMQ permissions, also explicitly giving full control to the user that the agent job executes as. Neither made a difference.

Any help would be greatly appreciated.
Cheers,
Tony Vaughan.

View 2 Replies View Related

ADODB And ActiveX

Jan 19, 2000

Hi,

Am having trouble writing to a table on the SQL 7 Server database, using a DTS ActiveX script.

When I try a .ADDNEW function, the following error comes up.
"The opperation required by the application is not supported by the provider."

The line preceding the .ADDNEW are as follows.
-----
SET Conn=CreateObject("ADODB.Connection")
SET RS = CreateObject("ADODB.RecordSet")
Conn.ConnectionString = "PROVIDER=SQLOLEDB;DATABASE=DataIn;User ID=sa;Password="
Conn.Open
RS.Open sqlSites, Conn
----

Q - Whats wrong ?

View 1 Replies View Related

DAO To ADODB Conversion?

Oct 25, 2013

I currently have an access database that is being converted to strictly a Front-End and SQL as the back-end. simple code conversion from DAO to ADODB? I would be very grateful for the infinite wisdom that resides within these boards.

Option Compare Database
Public LngLoginId As Long
Function LogMeIn(sUser As Long)
'/Go to the users table and record that the user has logged in
'/and which computer they have logged in from
Dim Rs As DAO.Recordset

[Code] ....

View 9 Replies View Related

Errors (ADODB)

Sep 3, 2007



Hi ! I'm using adodb in my program (Visual Basic)

I'm controlling the records with sql in a timer..Timer Interval = 7000

But i am getting some errors sometimes


Connectionwrite(send())

connectionwrite(recv())

It's often working non-problem but sometimes i am getting above errors

What are theese? and how can i solve this problem?

Thanks.

View 1 Replies View Related

ADODB To TextBox

Apr 5, 2007

First time poster, I am using MS Access and I have used the following code to get some data. It is as follows:






Code Snippet

Private Sub FillGUI()
On Error Resume Next



Dim myRS2 As New ADODB.Recordset



myRS2.ActiveConnection = CurrentProject.Connection
myRS2.CursorType = adOpenDynamic
myRS2.LockType = adLockOptimisticd
myRS2.Open "SELECT E.SSN, E.LNAME, SUM(W.HOURS) FROM EMPLOYEE E, WORKS_ON W WHERE (E.SSN = W.ESSN)GROUP BY E.SSN, E.LNAME HAVING(SUM(HOURS)) < 40"

MsgBox (myRS2.GetString)
myRS2.MoveFirst

End Sub





and I have the following output:



http://www.angelfire.com/oh5/ohiostate120/untitled1.JPG



This is what I want. However I need this to be in a text box so I have the following code:






Code Snippet

Private Sub FillGUI()
On Error Resume Next



Dim myRS2 As New ADODB.Recordset



myRS2.ActiveConnection = CurrentProject.Connection
myRS2.CursorType = adOpenDynamic
myRS2.LockType = adLockOptimisticd
myRS2.Open "SELECT E.SSN, E.LNAME, SUM(W.HOURS) FROM EMPLOYEE E, WORKS_ON W WHERE (E.SSN = W.ESSN)GROUP BY E.SSN, E.LNAME HAVING(SUM(HOURS)) < 40"

Me.txtEmployee.SetFocus
Me.txtEmployee.Text = myRS2.GetString
myRS2.MoveFirst

End Sub






And i get this:



http://www.angelfire.com/oh5/ohiostate120/untitled2.JPG




How can I get the text box format to look like the msgbox format? Thanks.........

View 2 Replies View Related

Textbox With ADODB

Apr 5, 2007

First time poster, I am using MS Access and I have used the following code to get some data. It is as follows:






Code Snippet

Private Sub FillGUI()
On Error Resume Next



Dim myRS2 As New ADODB.Recordset



myRS2.ActiveConnection = CurrentProject.Connection
myRS2.CursorType = adOpenDynamic
myRS2.LockType = adLockOptimisticd
myRS2.Open "SELECT E.SSN, E.LNAME, SUM(W.HOURS) FROM EMPLOYEE E, WORKS_ON W WHERE (E.SSN = W.ESSN)GROUP BY E.SSN, E.LNAME HAVING(SUM(HOURS)) < 40"

MsgBox (myRS2.GetString)
myRS2.MoveFirst

End Sub





and I have the following output:



http://www.angelfire.com/oh5/ohiostate120/untitled1.JPG



This is what I want. However I need this to be in a text box so I have the following code:






Code Snippet

Private Sub FillGUI()
On Error Resume Next



Dim myRS2 As New ADODB.Recordset



myRS2.ActiveConnection = CurrentProject.Connection
myRS2.CursorType = adOpenDynamic
myRS2.LockType = adLockOptimisticd
myRS2.Open "SELECT E.SSN, E.LNAME, SUM(W.HOURS) FROM EMPLOYEE E, WORKS_ON W WHERE (E.SSN = W.ESSN)GROUP BY E.SSN, E.LNAME HAVING(SUM(HOURS)) < 40"

Me.txtEmployee.SetFocus
Me.txtEmployee.Text = myRS2.GetString
myRS2.MoveFirst

End Sub






And i get this:



http://www.angelfire.com/oh5/ohiostate120/untitled2.JPG




How can I get the text box format to look like the msgbox format? Thanks

View 1 Replies View Related

ADODB Connection With SQL2000SP3

Jul 23, 2005

my code is using ADODB connection to connect to SQL (Virtual) Server.the way it being done is (c++):ADODB::_ConnectionPtr m_dbConn;ADODB::_RecordsetPtr m_dbRst;m_dbConn.CreateInstance(__uuidof(ADODB::Connection ));m_dbRst.CreateInstance( __uuidof( ADODB::Recordset ));m_dbConn->ConnectionString=( L"DSN=mydsn" );m_dbConn->Open("","sa","",-1);lately after installing SP3 over SQL2000, it was impossible to connect- the error message showed: login failed for user 'null)'. reason: notassociated with a trusted sql server connection.so i changed the connection string to:m_dbConn-> ConnectionString =(L"DSN=mydsn; UID=sa; PWD=;");m_dbConn->Open("","","",-1);and now it works !!what is the reason for that ?what in sql SP3 interrupt for this kind of connection ?what is the difference ?

View 1 Replies View Related

ADODB.Command Question

Sep 2, 2006

How to using Adodb.command to get Access file data??
i using this script:

dim connection as new adodb.connection
dim command as new adodb.command
dim recordset as new adodb.recordset

connection.open("connectionstring")
command.activeconnection=connection
command.commandtext="querystring"
recordset=command.execute

but,the Recordset is empty.how to using to get data on Microsoft Access database??



thank!!!!

View 1 Replies View Related

Recover Adodb::_ConnectionPtr

Aug 22, 2007

Most of the the time my connection is created and closed fine.

However, sometimes I get Connection failures (these happen often because I am connecting to the server using a VPN connection). Once I get the connection failure, sometimes I cannot successfully recreate the connection until I kill the application and restart it. Below is my open and release code. I call release anytime the connection fails or a stored procedure fails. If you see anything wrong with it the code below that would prevent the connection from recovering please let me know.

Thanks in advance.




Code Snippet
adodb::_ConnectionPtr m_spConnection;

HRESULT InitializeConnections()
{

HRESULT hr = E_FAIL;
if (m_spConnection && m_spConnection->GetState() == adodb::adStateOpen)
{

hr = S_OK;
}
else
{

if (m_spOperationEvents)
{

const _bstr_t c_bstrEmpty(_T(""));
try
{

CComBSTR bstrInit;
hr = get_DbInitializationString(&bstrInit);
if (!m_spConnection)
{

hr = m_spConnection.CreateInstance(adodb::CLSID_Connection);
}
if(SUCCEEDED(hr))
{


m_spConnection->ConnectionTimeout=30;

hr = m_spConnection->Open((LPCWSTR)bstrInit, c_bstrEmpty, c_bstrEmpty, -1);
}
}
catch (_com_error ce)
{

hr = E_FAIL;
CString strArgs;
strArgs.Format(_T("x%x %s "), ce.Error(), (LPCWSTR)ce.Description());
m_strLastError = GetTranslatedString(eMsgConnectionError, strArgs);
}
catch(HRESULT hrException)
{

hr = hrException;
}
catch(...)
{

hr = E_FAIL;
m_strLastError = GetTranslatedString(eMsgUnknownConnectionError, NULL);
}



}

}
if (!SUCCEEDED(hr))
{

ReleaseConnections();
}
return hr;
}
// Queued thread job to release thread resources
HRESULT CSptAggregation::ReleaseConnections()
{

HRESULT hr = E_FAIL;
try
{

if (m_spConnection)
{

m_spConnection->Cancel();
if (m_spConnection->GetState()== adodb::adStateOpen)

m_spConnection->Close();
}
m_spConnection = NULL;
}
catch (_com_error ce) { hr = E_FAIL; }
catch(...) { hr = E_FAIL; }
return S_OK;
}

View 1 Replies View Related

ADODB Vesion 7.0.3300.0 In Vb.net

Jun 23, 2006

Hi,

I have developed an application in vb.net 2005 Standard Edition and is running fine in my local machine. The executed version of the same application i tried to run in other machine and getting an error as follows :-

" Unable to install application. The application requires the assembly ADODB Version 7.0.3300.0 be installed in the global assembly cache (GAC) first "

Can you somebody help me to solve this problem.

Thanks

Saju John



View 3 Replies View Related

ADODB And Mirrored SQL-Server

Aug 24, 2006


I did setup a Mirrored Database. Connecting from it using ADO.NET works well. It goes to the Mirror if the Principal fails.

But ADODB does not work. I get the error following error:
80004005 Invalid connection string attribute

When trying to connect to the DB in case the principal failed and the mirror is active. (MyProductiveDB is in failover state)

What do I do wrong?


Here is the code:

ADOConn = New ADODB.Connection
ADOConn.Open(CS)

CS is my Connections-String:
"Provider=SQLNCLI.1;Data Source=MyProductiveDB;Failover Partner=MyMirror;Initial Catalog=MyCat;Persist Security Info=True;User ID=MyUser;Password=xxxxxx;Pooling=True;Connect Timeout=5;Application Name=MyApplic"

Remark: When I try to add "Network Library=dbmssocn" to the connection String, I get the same error, even if the Principal is active.

Your help is very much appreciated.
Beat

View 4 Replies View Related

ADODB CommandText Length

Sep 27, 2007

Hi,

I am trying to write a Macro in Excel which would connect to the database and fetch the data for me.

I am using a SQL Query and pass it to a ADODB Command object as adCmdText. The SQL Query is very big, length could be 2500 characters.

I just have read access to the database and do not have a choice to create a Stored Procedure to return a resultset.


When i try to open a recordset with the query, i get a Automation Error.

Is there a Limit on the length of the string i can pass as CommandText?

Regards,
Vikram

View 4 Replies View Related

Timeout Expired With ADODB

Apr 29, 2008

Hi All,

I am using SQL 2005 DB and i connect it using PHP. I have one Store procedure in SQL which requires 1.5 minutes to get result.

I'm always getting error message in web after 30 seconds that Microsoft OLEDB provider for ODBC drivers, timeout expired.

I increased time in php.ini but the error comes from SQL Server. Can you please guide me to increase the time in SQL. so that timeout doesn't expired.
This will help me a lot.

THanks in advance.
GB.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved