Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts

Saturday, February 25, 2012

ODBC Query ... getting Where Clause

OK ... I am using UPS Worldship that issues an ODBC query to my MS2K
server ... Worldship can query either a table or a view and retreive
shipping info for a supplied orderid.

I need to create a DB table that will track the orderids requested
from Worldship so that I can stop doubleships. That is to set up a
function to allow the info to be sent only once to worldship.

I need to execute a stored procedure to write to a table and enforce
biz logic.

So .. I've created a view that Worldship can execute an ODBC query
against (v_upsPull) ... in which I guess the query issued will be
like: SELECT * FROM v_upsPull WHERE orderid = 123456

The view is:

CREATE VIEW dbo.v_upsPull
AS
SELECT * FROM OPENROWSET ( 'SQLOLEDB', '[db]'; '[user]'; '[password]',
'exec sp_ups_pull')

When the ODBC query calls the view the sp_ups_pull store procedurer is
executed.

However ... I do not have access to the original Where clause in the
ODBC query in the stored procedurer.

Is there a way I can get access to the ODBC Where clause and pass it
into the stored procedurer?

If not is there some other way I can create a DB table and run a
select against it ... based on the Worldship query?wjreichard@.comcast.net wrote:

Quote:

Originally Posted by

OK ... I am using UPS Worldship that issues an ODBC query to my MS2K
server ... Worldship can query either a table or a view and retreive
shipping info for a supplied orderid.
(..)
If not is there some other way I can create a DB table and run a
select against it ... based on the Worldship query?


IMHO you won't get successful this way...

Perhaps SQL Server trace would be a solution?
You could capture all select queries executed against shipping
table/view and insert collected data into a table and then enforce
particular logic. The question is: how fast do you need the information
that certain orderid was retrieved? The only problem with trace-based
solution is that it can be potentially not fast enough.. (you can't read
the most current trace file if the trace is still running).

You may also try to implement some kind of 'select trigger':
http://solidqualitylearning.com/blo.../11/25/214.aspx
--
Best regards,
Marcin Guzowski
http://guzowski.info|||OK ... I think I got something that might work? I will create a unique
SQL login for the Worldship application and then using the above
method posted in my 1st post execute a stored procedurer and then
access the ODBC SQL with code prototyped in the following SP:

CREATE PROCEDURE dbo.sp_ups_pull AS
DECLARE @.spid int
DECLARE @.dbcc_cmd varchar(512)

CREATE TABLE #who (
spid int,
ecid int,
status varchar(255),
loginname varchar(255),
hostname varchar(255),
blk int,
dbname varchar(255),
cmd varchar(2048)
)
INSERT INTO #who EXEC ('sp_who worldshipuser')

SET @.spid = (SELECT spid FROM #who)
SET @.dbcc_cmd = 'DBCC INPUTBUFFER(' +
rtrim(ltrim(convert(char,@.spid))) + ')'

CREATE TABLE #buffer (
EventType varchar(512),
Parameters int,
EventInfo varchar(2048)
)

INSERT INTO #buffer EXEC (@.dbcc_cmd)

SELECT EventInfo FROM #buffer

[Additional biz logic etc.]
GO

------------------------------------------
Which return the ODBC SQL ... which I will parse the orderid from the
WHERE cluase.

So does anyone see major issues using this method? How do Input
Buffers relate to ODBC connections ... I guess I will need to ensure
that there is only ever one row returned from sp_who for my unique DB
users, Any one see other problems ... or a better solution?|||(wjreichard@.comcast.net) writes:

Quote:

Originally Posted by

OK ... I think I got something that might work? I will create a unique
SQL login for the Worldship application and then using the above
method posted in my 1st post execute a stored procedurer and then
access the ODBC SQL with code prototyped in the following SP:
>
CREATE PROCEDURE dbo.sp_ups_pull AS


Don't use sp_ as the first letters in your object names. This prefix
is reserved from system objects.

Quote:

Originally Posted by

Which return the ODBC SQL ... which I will parse the orderid from the
WHERE cluase.
>
So does anyone see major issues using this method? How do Input
Buffers relate to ODBC connections ... I guess I will need to ensure
that there is only ever one row returned from sp_who for my unique DB
users, Any one see other problems ... or a better solution?


A variation which is possibly even uglier, but nevertheless somewhat
more robust. Write a table-valued function. From this function call
xp_cmdshell, to start a new session in OSQL that runs the DBCC INPUTBUFFER
command. The point here is that you can read @.@.spid in the function
and this to the command string to OSQL. So at least that part is nicer.
But on the other hand you must arrange for worldshipuser to have privleges
to run xp_cmdshell, which is not to take lightly.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Monday, February 20, 2012

ODBC LIKE clause does not work - SQL Server *BUG*

Hi All:
I think there is a problem with the LIKE clause in a
SELECT statement. I am using the latest SQL Server 2000
(ver 8.00.760) and Visual C/C++ 6.00 (with SP3) on
Windows XP.
I created an ODBC connection and tied into a database
containing a customer table. The following piece of code
returns a record count of 0 (zero) when, in fact, the
record count should be over 2000.
=========================
#include <afxwin.h>
#include <stdio.h>
#include <sql.h>
#include <sqlext.h>
#define DATABASE_CLAUSE "MPOS_SQLSERVER"
#define USERNAME_CLAUSE ""
#define PASSWORD_CLAUSE ""
#define SELECT_CLAUSE "SELECT COUNT(*) from Customers
WHERE LastName LIKE ? "
#define LIKE_CLAUSE "A%"
void main( void )
{
HENV hEnv = SQL_NULL_HENV;
HDBC hDbc = SQL_NULL_HDBC;
HSTMT hStmt = SQL_NULL_HSTMT;
long lValue = 0;
SQLINTEGER sqlNull = 0;
SQLINTEGER sqlStrLen = SQL_NTS;
SQLUINTEGER sqlColumnLen = strlen( LIKE_CLAUSE );
SQLINTEGER sqlBufferLen = strlen( LIKE_CLAUSE );
SQLINTEGER sqlValue = 0;
if ( ! SQL_SUCCEEDED( SQLAllocEnv( &hEnv )))
printf( "Error in SQLAllocEnv()\n" );
else if ( ! SQL_SUCCEEDED( SQLAllocConnect( hEnv,
&hDbc )))
printf( "Error in SQLAllocConnect()\n" );
else if ( ! SQL_SUCCEEDED( SQLConnect( hDbc,
(SQLCHAR *)
DATABASE_CLAUSE, SQL_NTS,
(SQLCHAR *)
USERNAME_CLAUSE, SQL_NTS,
(SQLCHAR *)
PASSWORD_CLAUSE, SQL_NTS )))
printf( "Error in SQLConnect()\n" );
else if ( ! SQL_SUCCEEDED( SQLAllocStmt( hDbc,
&hStmt )))
printf( "Error in SQLAllocStmt()\n" );
else if ( ! SQL_SUCCEEDED( SQLPrepare( hStmt,
(SQLCHAR *)
SELECT_CLAUSE,
SQL_NTS )))
printf( "Error in SQLPrepare()\n" );
else if ( ! SQL_SUCCEEDED( SQLBindParameter( hStmt,
1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
SQL_CHAR,
0,
0,
LIKE_CLAUSE,
sqlBufferLen,
&sqlStrLen )))
printf( "Error in SQLBindParameter()\n" );
else if ( ! SQL_SUCCEEDED( SQLExecute( hStmt )))
printf( "Error in SQLExecute()\n" );
else if ( ! SQL_SUCCEEDED( SQLFetch( hStmt )))
printf( "Error in SQLFetch()\n" );
else if ( ! SQL_SUCCEEDED( SQLGetData( hStmt,
1,
SQL_C_LONG,
&sqlValue,
sizeof(
sqlValue ),
&sqlNull )))
printf( "Error in SQLGetData()\n" );
else
printf( "sqlValue/sizeof( sqlValue )/sqlNull = <%
ld>/<%ld>/<%ld>\n", sqlValue, sizeof( sqlValue ),
sqlNull );
}
=========================
When using the Query Analyzer and Enterprise Manager it
works. This is because, in the above code, I use the
SQLBindParameter() function to do the binding.
I've tried using the SQL Trace facility but it only shows
me the SQL statement being executed but does not indicate
any translations with the binded parameter.
Any suggestions or solutions would be greatly appreciated.
Regards,
AngeloWhen using SQL Trace, what is the text content of the query being executed?
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.
"Angelo Kalpakis" <angelo@.mrsonline.ca> wrote in message
news:06b101c3c712$93afb310$a401280a@.phx.gbl...
quote:

> Hi All:
> I think there is a problem with the LIKE clause in a
> SELECT statement. I am using the latest SQL Server 2000
> (ver 8.00.760) and Visual C/C++ 6.00 (with SP3) on
> Windows XP.
> I created an ODBC connection and tied into a database
> containing a customer table. The following piece of code
> returns a record count of 0 (zero) when, in fact, the
> record count should be over 2000.
> =========================
> #include <afxwin.h>
> #include <stdio.h>
> #include <sql.h>
> #include <sqlext.h>
> #define DATABASE_CLAUSE "MPOS_SQLSERVER"
> #define USERNAME_CLAUSE ""
> #define PASSWORD_CLAUSE ""
> #define SELECT_CLAUSE "SELECT COUNT(*) from Customers
> WHERE LastName LIKE ? "
> #define LIKE_CLAUSE "A%"
> void main( void )
> {
> HENV hEnv = SQL_NULL_HENV;
> HDBC hDbc = SQL_NULL_HDBC;
> HSTMT hStmt = SQL_NULL_HSTMT;
> long lValue = 0;
> SQLINTEGER sqlNull = 0;
> SQLINTEGER sqlStrLen = SQL_NTS;
> SQLUINTEGER sqlColumnLen = strlen( LIKE_CLAUSE );
> SQLINTEGER sqlBufferLen = strlen( LIKE_CLAUSE );
> SQLINTEGER sqlValue = 0;
> if ( ! SQL_SUCCEEDED( SQLAllocEnv( &hEnv )))
> printf( "Error in SQLAllocEnv()\n" );
> else if ( ! SQL_SUCCEEDED( SQLAllocConnect( hEnv,
> &hDbc )))
> printf( "Error in SQLAllocConnect()\n" );
> else if ( ! SQL_SUCCEEDED( SQLConnect( hDbc,
> (SQLCHAR *)
> DATABASE_CLAUSE, SQL_NTS,
> (SQLCHAR *)
> USERNAME_CLAUSE, SQL_NTS,
> (SQLCHAR *)
> PASSWORD_CLAUSE, SQL_NTS )))
> printf( "Error in SQLConnect()\n" );
> else if ( ! SQL_SUCCEEDED( SQLAllocStmt( hDbc,
> &hStmt )))
> printf( "Error in SQLAllocStmt()\n" );
> else if ( ! SQL_SUCCEEDED( SQLPrepare( hStmt,
> (SQLCHAR *)
> SELECT_CLAUSE,
> SQL_NTS )))
> printf( "Error in SQLPrepare()\n" );
> else if ( ! SQL_SUCCEEDED( SQLBindParameter( hStmt,
> 1,
> SQL_PARAM_INPUT,
> SQL_C_CHAR,
> SQL_CHAR,
> 0,
> 0,
> LIKE_CLAUSE,
> sqlBufferLen,
> &sqlStrLen )))
> printf( "Error in SQLBindParameter()\n" );
> else if ( ! SQL_SUCCEEDED( SQLExecute( hStmt )))
> printf( "Error in SQLExecute()\n" );
> else if ( ! SQL_SUCCEEDED( SQLFetch( hStmt )))
> printf( "Error in SQLFetch()\n" );
> else if ( ! SQL_SUCCEEDED( SQLGetData( hStmt,
> 1,
> SQL_C_LONG,
> &sqlValue,
> sizeof(
> sqlValue ),
> &sqlNull )))
> printf( "Error in SQLGetData()\n" );
> else
> printf( "sqlValue/sizeof( sqlValue )/sqlNull = <%
> ld>/<%ld>/<%ld>\n", sqlValue, sizeof( sqlValue ),
> sqlNull );
> }
>
> =========================
> When using the Query Analyzer and Enterprise Manager it
> works. This is because, in the above code, I use the
> SQLBindParameter() function to do the binding.
> I've tried using the SQL Trace facility but it only shows
> me the SQL statement being executed but does not indicate
> any translations with the binded parameter.
> Any suggestions or solutions would be greatly appreciated.
> Regards,
> Angelo
|||When using the SQL Trace, the following is the snippet
from the log file...
=======================
rawodbc f38-f34 ENTER SQLPrepare
HSTMT 00391FE0
UCHAR * 0x00402104 [ -
3] "SELECT COUNT(*) from Customers WHERE LastName LIKE ?
\ 0"
SDWORD -3
=======================
If you'd like to see the entire log file, I can post that
too.
quote:

>--Original Message--
>When using SQL Trace, what is the text content of the

query being executed?
quote:

>--
>Brannon Jones
>Developer - MDAC
>This posting is provided "as is" with no warranties and

confers no rights.
quote:

>
>"Angelo Kalpakis" <angelo@.mrsonline.ca> wrote in message
>news:06b101c3c712$93afb310$a401280a@.phx.gbl...
code[QUOTE]
SQL_CHAR,[QUOTE]
<%[QUOTE]
shows[QUOTE]
indicate[QUOTE]
appreciated.[QUOTE]
>
>.
>
|||I tried the following and it works fine:
rc = SQLBindParameter(hstmt,
1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
SQL_CHAR,
2,
0,
"C%",
2,
NULL);
If I change the call to be like your example (passing 0 for the cbColDef
parameter) then I get an error trying to bind the parameter. What ODBC
version does your app set? 3.0 or earlier?
Try specifying the length of the string in the cbColDef parameter as well.
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.
"Angelo Kalpakis" <angelo@.mrsonline.ca> wrote in message
news:0d9401c3d658$1c963ce0$a001280a@.phx.gbl...[QUOTE]
> When using the SQL Trace, the following is the snippet
> from the log file...
> =======================
> rawodbc f38-f34 ENTER SQLPrepare
> HSTMT 00391FE0
> UCHAR * 0x00402104 [ -
> 3] "SELECT COUNT(*) from Customers WHERE LastName LIKE ?
> \ 0"
> SDWORD -3
> =======================
> If you'd like to see the entire log file, I can post that
> too.
>
> query being executed?
> confers no rights.
> code
> SQL_CHAR,
> <%
> shows
> indicate
> appreciated.|||Thank you, thank you, thank you...
I am using ODBC version 2.x. The fix is the specification
of the 2 as the ColumnSize parameter.
It's funny how things work differently with Access and
SQLServer eventhough they are from the same manufacturer.
Thanks again.
quote:

>--Original Message--
>I tried the following and it works fine:
> rc = SQLBindParameter(hstmt,
> 1,
> SQL_PARAM_INPUT,
> SQL_C_CHAR,
> SQL_CHAR,
> 2,
> 0,
> "C%",
> 2,
> NULL);
>If I change the call to be like your example (passing 0

for the cbColDef
quote:

>parameter) then I get an error trying to bind the

parameter. What ODBC
quote:

>version does your app set? 3.0 or earlier?
>Try specifying the length of the string in the cbColDef

parameter as well.
quote:

>--
>Brannon Jones
>Developer - MDAC
>This posting is provided "as is" with no warranties and

confers no rights.
quote:

>
>"Angelo Kalpakis" <angelo@.mrsonline.ca> wrote in message
>news:0d9401c3d658$1c963ce0$a001280a@.phx.gbl...
LIKE ?[QUOTE]
that[QUOTE]
and[QUOTE]
message[QUOTE]
2000[QUOTE]
database[QUOTE]
the[QUOTE]
Customers[QUOTE]
LIKE_CLAUSE );[QUOTE]
hEnv,[QUOTE]
*)[QUOTE]
*)[QUOTE]
*)[QUOTE]
*)[QUOTE]
SQL_NTS )))[QUOTE]
hStmt,[QUOTE]
SQL_C_LONG,[QUOTE]
&sqlValue,[QUOTE]
&sqlNull )))[QUOTE]
sqlValue )/sqlNull =[QUOTE]
Manager it[QUOTE]
>
>.
>
|||Access and SQL Server are two completely different products (produced by
different groups here at Microsoft).
If you are using the SQL driver in 2.x mode, then it will allow you to
specify a zero-length precision, but obviously the behavior is not what you
expected. If you are using the SQL driver in 3.0 mode, then it will error
out if you specify a zero-length precision.
When binding parameters, you should always give the precision. In this
case, if you give a precision of zero, then we think the parameter (on the
server-side) has a length of zero, and so we truncate whatever data you give
us. Not the best behavior, but that's how it works. The precision (in
conjunction with the SQL data type) describes the type on the server.
Brannon Jones
Developer - MDAC
This posting is provided "as is" with no warranties and confers no rights.
"Angelo Kalpakis" <angelo@.mrsonline.ca> wrote in message
news:0bc501c3d9e7$2fd1d7a0$a401280a@.phx.gbl...[QUOTE]
> Thank you, thank you, thank you...
> I am using ODBC version 2.x. The fix is the specification
> of the 2 as the ColumnSize parameter.
> It's funny how things work differently with Access and
> SQLServer eventhough they are from the same manufacturer.
> Thanks again.
>
> for the cbColDef
> parameter. What ODBC
> parameter as well.
> confers no rights.
> LIKE ?
> that
> and
> message
> 2000
> database
> the
> Customers
> LIKE_CLAUSE );
> hEnv,
> *)
> *)
> *)
> *)
> SQL_NTS )))
> hStmt,
> SQL_C_LONG,
> &sqlValue,
> &sqlNull )))
> sqlValue )/sqlNull =
> Manager it

ODBC LIKE clause

I'm trying to execute the following query within a Visual
C++ program...
SELECT LastName from Employees WHERE LastName LIKE ?
In the C++ program, I use the SQLBindParameter() to
associate to the ?. The SQLBindParameter() variable used
contains 'A%' (without the single quote).
This is a very simple statement, but constantly returns
no data.
I run this exact statement within a MS Access database
connection, and it returns 4 records. The MS Access wild
card is also 'A%'. I think there is a bug in the SQL
Server ODBC, but I cannot confirm this.
Using the SQL Trace doesn't tell me the translations
being performed within the ODBC driver to confirm a bug.
Help...please...
Regards,
AngeloHi Angelo,
The SQL Trace (you are using SQL 7 ?) will tell you the command the SQL
Servers sees. What does that look like?
Also have you tried 'A*' or have you tired
SELECT LastName from Employees WHERE LastName LIKE '?'
Just some ideas, I hope you fix the issue.
I hope this helps
regards
Greg O MCSD
http://www.ag-software.com/ags_scribe_index.asp. SQL Scribe Documentation
Builder, the quickest way to document your database
http://www.ag-software.com/ags_SSEPE_index.asp. AGS SQL Server Extended
Property Extended properties manager for SQL 2000
http://www.ag-software.com/IconExtractionProgram.asp. Free icon extraction
program
http://www.ag-software.com. Free programming tools
"Angelo" <anonymous@.discussions.microsoft.com> wrote in message
news:04ee01c3b861$09b06700$a301280a@.phx.gbl...
quote:

> I'm trying to execute the following query within a Visual
> C++ program...
> SELECT LastName from Employees WHERE LastName LIKE ?
> In the C++ program, I use the SQLBindParameter() to
> associate to the ?. The SQLBindParameter() variable used
> contains 'A%' (without the single quote).
> This is a very simple statement, but constantly returns
> no data.
> I run this exact statement within a MS Access database
> connection, and it returns 4 records. The MS Access wild
> card is also 'A%'. I think there is a bug in the SQL
> Server ODBC, but I cannot confirm this.
> Using the SQL Trace doesn't tell me the translations
> being performed within the ODBC driver to confirm a bug.
> Help...please...
> Regards,
> Angelo
|||Thanks for the reply...
I'm using SQL 8. I will try the TRACE again. I've tried
your other suggestions but still get the same results.
Later,
quote:

>--Original Message--
>Hi Angelo,
>The SQL Trace (you are using SQL 7 ?) will tell you the

command the SQL
quote:

>Servers sees. What does that look like?
>Also have you tried 'A*' or have you tired
>SELECT LastName from Employees WHERE LastName LIKE '?'
>Just some ideas, I hope you fix the issue.
>
>--
>I hope this helps
>regards
>Greg O MCSD
>http://www.ag-software.com/ags_scribe_index.asp. SQL

Scribe Documentation
quote:

>Builder, the quickest way to document your database
>http://www.ag-software.com/ags_SSEPE_index.asp. AGS SQL

Server Extended
quote:

>Property Extended properties manager for SQL 2000
>http://www.ag-software.com/IconExtractionProgram.asp.

Free icon extraction
quote:

>program
>http://www.ag-software.com. Free programming tools
>
>"Angelo" <anonymous@.discussions.microsoft.com> wrote in

message
quote:

>news:04ee01c3b861$09b06700$a301280a@.phx.gbl...
Visual[QUOTE]
used[QUOTE]
wild[QUOTE]
bug.[QUOTE]
>
>.
>
|||Could you post all the parameters for SQLBindParameter() method. I am
pretty confident that 'A%' is the correct syntax
Pete
Angelo wrote:
quote:

>I'm trying to execute the following query within a Visual
>C++ program...
>SELECT LastName from Employees WHERE LastName LIKE ?
>In the C++ program, I use the SQLBindParameter() to
>associate to the ?. The SQLBindParameter() variable used
>contains 'A%' (without the single quote).
>This is a very simple statement, but constantly returns
>no data.
>I run this exact statement within a MS Access database
>connection, and it returns 4 records. The MS Access wild
>card is also 'A%'. I think there is a bug in the SQL
>Server ODBC, but I cannot confirm this.
>Using the SQL Trace doesn't tell me the translations
>being performed within the ODBC driver to confirm a bug.
>Help...please...
>Regards,
>Angelo
>

You don't pay to get spam, why pay to clean it?
Visit http://www.spammarshall.com to create an account for free
<http://www.spammarshall.com>|||I'm probably saying something pretty dumb right now.. but how are you using
ODBC?
Why can you not simply (assuming you're using MS Visual C++ with MFC) do:
CString sql;
sql.Format(_T("SELECT LastName from Employees WHERE LastName LIKE %s",
_T("A%%");
rs.Open(sql...)
Or something like that.. ?
"Angelo" <anonymous@.discussions.microsoft.com> wrote in message
news:04ee01c3b861$09b06700$a301280a@.phx.gbl...
quote:

> I'm trying to execute the following query within a Visual
> C++ program...
> SELECT LastName from Employees WHERE LastName LIKE ?
> In the C++ program, I use the SQLBindParameter() to
> associate to the ?. The SQLBindParameter() variable used
> contains 'A%' (without the single quote).
> This is a very simple statement, but constantly returns
> no data.
> I run this exact statement within a MS Access database
> connection, and it returns 4 records. The MS Access wild
> card is also 'A%'. I think there is a bug in the SQL
> Server ODBC, but I cannot confirm this.
> Using the SQL Trace doesn't tell me the translations
> being performed within the ODBC driver to confirm a bug.
> Help...please...
> Regards,
> Angelo
|||Here is a sample application that results in a zero
records found eventhrough there are a number of records
within the table.
================================
#include <afxwin.h>
#include <stdio.h>
#include <sql.h>
#include <sqlext.h>
#define DATABASE_CLAUSE "MPOS_SQLSERVER"
#define USERNAME_CLAUSE ""
#define PASSWORD_CLAUSE ""
#define SELECT_CLAUSE "SELECT COUNT(*) from Customers
WHERE LastName LIKE ? "
#define LIKE_CLAUSE "A%"
void main( void )
{
HENV hEnv = SQL_NULL_HENV;
HDBC hDbc = SQL_NULL_HDBC;
HSTMT hStmt = SQL_NULL_HSTMT;
long lValue = 0;
SQLINTEGER sqlNull = 0;
SQLINTEGER sqlStrLen = SQL_NTS;
SQLUINTEGER sqlColumnLen = strlen( LIKE_CLAUSE );
SQLINTEGER sqlBufferLen = strlen( LIKE_CLAUSE );
SQLINTEGER sqlValue = 0;
if ( ! SQL_SUCCEEDED( SQLAllocEnv( &hEnv )))
printf( "Error in SQLAllocEnv()\n" );
else if ( ! SQL_SUCCEEDED( SQLAllocConnect( hEnv,
&hDbc )))
printf( "Error in SQLAllocConnect()\n" );
else if ( ! SQL_SUCCEEDED( SQLConnect( hDbc,
(SQLCHAR *)
DATABASE_CLAUSE, SQL_NTS,
(SQLCHAR *)
USERNAME_CLAUSE, SQL_NTS,
(SQLCHAR *)
PASSWORD_CLAUSE, SQL_NTS )))
printf( "Error in SQLConnect()\n" );
else if ( ! SQL_SUCCEEDED( SQLAllocStmt( hDbc,
&hStmt )))
printf( "Error in SQLAllocStmt()\n" );
else if ( ! SQL_SUCCEEDED( SQLPrepare( hStmt,
(SQLCHAR *)
SELECT_CLAUSE,
SQL_NTS )))
printf( "Error in SQLPrepare()\n" );
else if ( ! SQL_SUCCEEDED( SQLBindParameter( hStmt,
1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
SQL_CHAR,
0,
0,
LIKE_CLAUSE,
sqlBufferLen,
&sqlStrLen )))
printf( "Error in SQLBindParameter()\n" );
else if ( ! SQL_SUCCEEDED( SQLExecute( hStmt )))
printf( "Error in SQLExecute()\n" );
else if ( ! SQL_SUCCEEDED( SQLFetch( hStmt )))
printf( "Error in SQLFetch()\n" );
else if ( ! SQL_SUCCEEDED( SQLGetData( hStmt,
1,
SQL_C_LONG,
&sqlValue,
sizeof(
sqlValue ),
&sqlNull )))
printf( "Error in SQLGetData()\n" );
else
printf( "sqlValue/sizeof( sqlValue )/sqlNull = <%
ld>/<%ld>/<%ld>\n", sqlValue, sizeof( sqlValue ),
sqlNull );
}
================================
I am using the latest SQL Server 8 with Visual C/C++ 6.00.
Everything has the latest software patches including the
DB and compilers.
Regards,
Angelo
quote:

>--Original Message--
>Could you post all the parameters for SQLBindParameter()

method. I am
quote:

>pretty confident that 'A%' is the correct syntax
>Pete
>Angelo wrote:
>
Visual[QUOTE]
used[QUOTE]
wild[QUOTE]
>--
>You don't pay to get spam, why pay to clean it?
>Visit http://www.spammarshall.com to create an account

for free
quote:

><http://www.spammarshall.com>
>
>