Re: Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- From: "Mike Epprecht \(SQL MVP\)" <mike@xxxxxxxxxxxx>
- Date: Sat, 10 Sep 2005 04:32:10 +0200
Hi
SQL Server 2005 CTP questions to the community newsgroups:
http://communities.microsoft.com/newsgroups/default.asp?icp=sqlserver2005&slcid=us
--
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@xxxxxxxxxxxx
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Nick Palmer" <nick@xxxxxxxxxxx> wrote in message
news:11i480ff7qiikf9@xxxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I'm trying to test some 64-bit ODBC stuff and I'm running into a slight
> problem. First, my configuration.
>
> Windows XP x64
> VS.Net 2005 Beta 2
> SQL Server 2005 CTP
>
> So, I have built and tested other 64 bit apps so I know that things are
> all
> working, but now I'm trying to test ODBC and I'm running into a problem.
> I
> have the following code :
>
> SQLCHAR Database[MAXBUFLEN]; // = "Cloud";
> SQLCHAR User[MAXBUFLEN]; // = "fred";
> SQLCHAR Pass[MAXBUFLEN]; // = "me";
>
> sprintf ((char *)Database, "%s", "Cloud");
> sprintf ((char *)User, "%s", "fred");
> sprintf ((char *)Pass, "%s", "me");
>
> retcode = SQLConnect(hdbc1, Database, SQL_NTS,
> User, SQL_NTS, Pass, SQL_NTS);
>
> If I execute this code as part of a little test program on my 32 bit box,
> it
> connects just fine. Now, to get this code to compile on the 64-bit box, I
> have to cast the string variable with (SQLWCHAR *) like this.
>
> retcode = SQLConnect(hdbc1, (SQLWCHAR *)Database, SQL_NTS,
> (SQLWCHAR *)User, SQL_NTS, (SQLWCHAR *)Pass, SQL_NTS);
>
> So it compiles, but when I run it, I get an error back. If I take a look
> at what (SQLWCHAR *)Database produces, its some unreadable junk. If I
> turn
> on ODBC logging and then after the SQLConnect call take a look at the log,
> where I should see the database for instance, I see just random
> characters.
>
> So, what gives ? Do I have to do something special when working with
> SQLWCHAR ?
>
> Thanks for any help anyone can give me.
>
> Nick
>
>
.
- References:
- Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- From: Nick Palmer
- Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- Prev by Date: Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- Next by Date: RE: Asking again - ResultSet.getString() & unicode
- Previous by thread: Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- Index(es):
Relevant Pages
|