vc ++中的ODBC连接 [英] ODBC connectivity in vc++

查看:120
本文介绍了vc ++中的ODBC连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按如下方式连接ODBC数据库:

I am trying to connect ODBC database as follows:

CDatabase m_database;
	CRecordset m_recordset; 
	CString strSQL,PlateNo;
	CString conn=(L"DRIVER=SQL Server Native Client 10.0;SERVER=.\\SQLEXPRESS;Trusted_Connection=Yes;APP=Microsoft\x00ae Visual Studio\x00ae 2010;WSID=EGGEN2;DATABASE=DB01;");
	m_database.Open(conn);
	m_recordset.m_pDatabase=&m_database;
	strSQL.Format(L"select * from NP where S.NO.=1");
	m_recordset.Open(CRecordset::forwardOnly,strSQL);
	if(m_recordset.GetRecordCount()>0)
	{
	m_recordset.GetFieldValue(L"PLATE NO",PlateNo);
	}
	m_recordset.Close();
	m_database.Close();





它给出错误无法创建空文档



当我调试它时,我发现的错误是在行m_database.Open(conn);



Pl建议解决方案



It gives an error "Failed to create empty document"

When i debugged it,the error i found was in the line "m_database.Open(conn);"

Pl suggest a solution

推荐答案

https ://www.google.com/search?q = Failed + to + create + empty + document [ ^ ]。


这篇关于vc ++中的ODBC连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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