字符串转换问题 [英] string conversion problems

查看:43
本文介绍了字符串转换问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的控制台应用程序中有以下行:


_bstr_t strCnn(" my database connection string");


with数据库连接字符串硬编码如上,它工作,我连接

到我的数据库。


当我将数据库连接字符串读入一个字符串变量控制台

并尝试使用它或我将其转换为strCnn的参数

我无法连接。任何帮助将不胜感激。


ps


我知道_bstr_t不是标准C ++的一部分,它是微软的C ++类。


有关于_bstr_t的信息在整个网络上,但我仍然无法获取我的代码

工作,所以我在这里发帖。


发布通过Usenet.com高级Usenet新闻组服务

-------------------- --------------------------------------

** SPEED * *保留**完成**匿名**

-------------------------------- --------------------------
http://www.usenet.com


---- ==通过Newsfeed.Com发布 - 无限制 - 未经审查-Secure Usenet News == ----
http://www.newsfeed.com 世界排名第一的新闻组服务! > 100,000新闻组

--- = 19东/西海岸专业服务器 - 通过加密的总隐私= ---

解决方案

"阿莱克斯" <人************* @ verizon.net>写在

news:40 ********** @ 127.0.0.1:

我知道_bstr_t不是标准C ++的一部分,它是来自
microsoft的C ++类。

有关_bstr_t的信息,但我仍然无法获取我的代码
'我在这里发帖。




一个关于微软图书馆课程的更好的地方是微软

新闻组。尝试其中一种:


microsoft.public.vc.language

microsoft.public.vc.stl

microsoft.public .vc.atl


如果您的新闻服务器没有携带这些群组,您可以通过msnews.microsoft获取这些群组

Microsoft的服务器.COM。有数百个

库,几十个操作系统和几十个编译器,如果

人们在这里发布所有这些,那就会非常嘈杂。 br />

Gregg


" alex" <人************* @ verizon.net>在消息中写道

news:40 ********** @ 127.0.0.1 ...

我的控制台应用程序中有以下行:<

_bstr_t strCnn("我的数据库连接字符串");

数据库连接字符串硬编码如上,
它可以工作,我连接到我的数据库。

当我从控制台读取一个字符串
变量的db连接字符串并尝试使用它或我将其转换为strCnn的
参数时,我可以''连接。任何帮助都将不胜感激。



我知道_bstr_t不是标准C ++的一部分,它是来自microsoft的C ++
类。
整个网络上都有关于_bstr_t的信息,但我仍然不能
让我的代码工作,所以我在这里发帖。



< snip> ;


< OT>

出于病态的好奇心,当你确实发生了什么?b $ b尝试了

string dasfk =" my database connection string";

const _bstr_t strCnn(dasfk.c_str());

< / OT>


Gregg写道:

一个关于Microsoft库类的更好的地方是Microsoft
新闻组。试试其中一个:

microsoft.public.vc.language
microsoft.public.vc.stl
microsoft.public.vc.atl

如果您的新闻服务器没有携带这些组,您可以在msnews.microsoft.com上的Microsoft服务器上获取它们。有数百个库,几十个操作系统和几十个编译器,如果有人在这里发布所有这些,那就会非常嘈杂。




而且我们的回复会变得不那么准确。


当然我知道Gtk +的gchar如何工作!!


-

Phlip
http://industrialxp.org/community/bi...UserInterfaces


i have the following line in my console app:

_bstr_t strCnn("my database connection string");

with the database connection string hard coded as above, it works, i connect
to my db.

when i read the db connection string into a string variable from the console
and try to use it or something i converted it into as the argument to strCnn
I can''t connect. Any help would be appreciated.

ps

I know _bstr_t is not part of standard C++, it''s a C++ class from microsoft.

there''s info on _bstr_t all over the web but i still can''t get my code to
work so i''m posting here.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

解决方案

"alex" <al*************@verizon.net> wrote in
news:40**********@127.0.0.1:

I know _bstr_t is not part of standard C++, it''s a C++ class from
microsoft.

there''s info on _bstr_t all over the web but i still can''t get my code
to work so i''m posting here.



A better place to ask about a Microsoft library class would be a Microsoft
newsgroup. Try one of these:

microsoft.public.vc.language
microsoft.public.vc.stl
microsoft.public.vc.atl

If your news server doesn''t carry these groups, you can get them on
Microsoft''s server at msnews.microsoft.com. There are hundreds of
libraries, dozens of operating systems and dozens of compilers, and if
people were to post about all these in here, it would get very noisy.

Gregg


"alex" <al*************@verizon.net> wrote in message
news:40**********@127.0.0.1...

i have the following line in my console app:

_bstr_t strCnn("my database connection string");

with the database connection string hard coded as above, it works, i connect to my db.

when i read the db connection string into a string variable from the console and try to use it or something i converted it into as the argument to strCnn I can''t connect. Any help would be appreciated.

ps

I know _bstr_t is not part of standard C++, it''s a C++ class from microsoft.
there''s info on _bstr_t all over the web but i still can''t get my code to work so i''m posting here.


<snip>

<OT>
Just out of morbid curiosity, what exactly happened when you
tried
string dasfk = "my database connection string";
const _bstr_t strCnn(dasfk.c_str());
</OT>


Gregg wrote:

A better place to ask about a Microsoft library class would be a Microsoft
newsgroup. Try one of these:

microsoft.public.vc.language
microsoft.public.vc.stl
microsoft.public.vc.atl

If your news server doesn''t carry these groups, you can get them on
Microsoft''s server at msnews.microsoft.com. There are hundreds of
libraries, dozens of operating systems and dozens of compilers, and if
people were to post about all these in here, it would get very noisy.



And our replies would get much less accurate.

Sure I know how Gtk+''s gchar works!!

--
Phlip
http://industrialxp.org/community/bi...UserInterfaces


这篇关于字符串转换问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆