473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

QueryDef with GUID parameters - ODBC Call Failed Errors

Hi all. Need help here as I cant see whats wrong...

I have a querydef in Access 2k which execs a stored proc in a SQL
Server 2k db.
I keep getting the following error, and cant stop it for the life of
me:

"Error 3146: ODBC Call Failed"

Now, the stored proc uses @RETURN_VALUE to pass back an integer result
to the calling process (in this case Access), so I am using
ReturnsRecords = true and qdf.openrecordset to run it.

When it runs from Access i get the errors, when i run it from SQL
Query analyaer it runs fine. I have another querydef in another db
that does the same thing and works fine - the only difference is the
OK one does not use GUIDs as parameters. I was wondering (maybe due to
MS Access' dislike of GUIDs) if this could be the problem causing the
ODBC call failed errors, or if there is something else I have missed
..... here is my code:

Dim strItemGUID As String
dim strSourceGUID as string
Dim Qdf As QueryDef
Dim rst As DAO.Recordset
Set Qdf = CurrentDb.CreateQueryDef("")
Qdf.Connect = CurrentDb.TableDefs(0).Connect 'same as linked tables in
db
Qdf.ReturnsRecords = True
Qdf.SQL = "RBE_sp_ChangeQuestionSource '" & strItemGUID & "', '" &
strSourceGUID & "'"
Set rst = Qdf.OpenRecordset()

.... in the last line also tried assigning return to an integer instead
of a recordset, but same errors.

(note that also, - Access hates GUIDs, so you have to refer to them in
their string context as Access cant deal with Byte arrays or something
like that).

In SQL Server, varchar/char > UniqueIdentifier conversions are
implicit, but I wonder if this does not happen when using a QDF in
Access and feeding strings in for GUIDs??

I need some clarification, help, and ideas on how to get this working.
I DO NOT want to use string params and convert them within the stored
proc (if i can avoid it).
ideas? suggestions? help?

Many thanks in advance
Karl
Nov 13 '05 #1
1 4131
On 29 Sep 2004 15:30:29 -0700, ka*****@hotmail.com (VBSponge) wrote:

Try this:
Qdf.SQL = "RBE_sp_ChangeQuestionSource '" &
StringFromGUID(strItemGUID) & "', '" &
StringFromGUID(strSourceGUID) & "'"

-Tom.

Hi all. Need help here as I cant see whats wrong...

I have a querydef in Access 2k which execs a stored proc in a SQL
Server 2k db.
I keep getting the following error, and cant stop it for the life of
me:

"Error 3146: ODBC Call Failed"

Now, the stored proc uses @RETURN_VALUE to pass back an integer result
to the calling process (in this case Access), so I am using
ReturnsRecords = true and qdf.openrecordset to run it.

When it runs from Access i get the errors, when i run it from SQL
Query analyaer it runs fine. I have another querydef in another db
that does the same thing and works fine - the only difference is the
OK one does not use GUIDs as parameters. I was wondering (maybe due to
MS Access' dislike of GUIDs) if this could be the problem causing the
ODBC call failed errors, or if there is something else I have missed
.... here is my code:

Dim strItemGUID As String
dim strSourceGUID as string
Dim Qdf As QueryDef
Dim rst As DAO.Recordset
Set Qdf = CurrentDb.CreateQueryDef("")
Qdf.Connect = CurrentDb.TableDefs(0).Connect 'same as linked tables in
db
Qdf.ReturnsRecords = True
Qdf.SQL = "RBE_sp_ChangeQuestionSource '" & strItemGUID & "', '" &
strSourceGUID & "'"
Set rst = Qdf.OpenRecordset()

... in the last line also tried assigning return to an integer instead
of a recordset, but same errors.

(note that also, - Access hates GUIDs, so you have to refer to them in
their string context as Access cant deal with Byte arrays or something
like that).

In SQL Server, varchar/char > UniqueIdentifier conversions are
implicit, but I wonder if this does not happen when using a QDF in
Access and feeding strings in for GUIDs??

I need some clarification, help, and ideas on how to get this working.
I DO NOT want to use string params and convert them within the stored
proc (if i can avoid it).
ideas? suggestions? help?

Many thanks in advance
Karl


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
2
by: Jimbo | last post by:
I have an access 97 database linked to sql server..I click update on a form and get an error message: Run-time error 3146 ODBC call failed The debugger points to this line: MyTable.Update
0
by: jason | last post by:
I have the following code in a C# class library method: // GUID VERSION Guid gUserID = new Guid(sUserID); Guid gAuthorityID = new Guid(AuthorityID); oCommand.Parameters.Append(...
1
by: Mikey G | last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL database and loads a table into a Dataset, and then displays that table information in a DataGrid on a...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
0
by: hello_2you | last post by:
Hello, I have a vb program that connects to odbc to an sqlexpress server. When i try to write data to the db, i get this message: Release Error: Script #1 (Ascent Capture Database) "de...
2
by: Ben | last post by:
Hi! It has been weeks now that I have been trying to fix an error that I encounter everytime it gets to the code at runtime: SQLStmt = "SELECT Sum() As TotalInStock, Sum( * ) AS TotalCost " & _...
16
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.