帮忙看看这个链接字符串

gavin_xgc 2005-12-09 04:27:43
OdbcConnection my_conn;
OdbcDataAdapter my_Adapter;
string my_StrConnection= @"Driver=Sybase SQL Anywhere 5.0; DefaultDir=E:\MyWork;Dbf=E:\MyWork\专业报表.db;Uid=dba;Pwd=dba;dsn="""";";
my_conn = new OdbcConnection(my_StrConnection);
my_conn.Open();

open 出错 错误信息
System.Data.Odbc.OdbcException: ERROR [08001] [Sybase][ODBC Driver]Unable to connect to database server: database name required to start engine
ERROR [01S00] [Sybase][ODBC Driver]Invalid connection string attribute
ERROR [01S00] [Sybase][ODBC Driver]Invalid connection string attribute
ERROR [01S00] [Sybase][ODBC Driver]Invalid connection string attribute
ERROR [01000] [Microsoft][ODBC 驱动程序管理器] 驱动程序不支持这个应用程序请求的 ODBC 行为的版本 (参见 SQLSetEnvAttr)。
at System.Data.Odbc.OdbcConnection.Open()
at WindowsApplication2.Form1.button1_Click(Object sender, EventArgs e) in e:\pre work\windowsapplication2\form1.cs:line 159

这是什么问题啊?
...全文
203 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
youyuan1980 2005-12-10
  • 打赏
  • 举报
回复
ODBC连接Access系统数据库
conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=\\server\share\a.mdb;");
这个比较常用。
ChengKing 2005-12-10
  • 打赏
  • 举报
回复
仅能提供参考资料,希有所帮助:

1.ODBC连接Access本地数据库
conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=C:\a.mdb;"+
"Uid=Admin;"+"Pwd=;");
2.ODBC连接Access系统数据库
conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=C:\a.mdb;"+
"SystemDB=Admin;"+"Pwd=;");
3.ODBC连接Access系统数据库
conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=\\server\share\a.mdb;");
4.ODBC连接Excel系统数据库
conGoodDay.Open("Driver={Microsoft Access Driver(*.xls)};"+"DriverId=790;"+
"Dbq=C:\a.xls;"+"DefaultDir=c:\somepath;");
5.ODBC连接Oracle系统数据库
conGoodDay.Open("Driver={Microsoft ODBC for Oracle};"+"Server=OracleServer.world;"+
"Uid=Admin;"+"Pwd=password;");
6.ODBC连接Sql Servr
conGoodDay.Open("Driver={Sql Server};"+"Server=myServer;"+"Database=myDatabaseName;"
"Uid=Admin;"+"Pwd=password;");
7.ODBC连接Visual FoxPro
conGoodDay.Open("Driver={Microsoft Visual FoxPro Driver};"+
"SourceType=DBC;"+"SourceDB=c:a.dbc;"+"Exclusive=No;");
youyuan1980 2005-12-10
  • 打赏
  • 举报
回复
建议使用控件,在最左边的工具项中,有数据栏,里面会有这个控件,你可以找到的,然后在属性上寻找地址不就行了,还可以测试连接呢。
gavin_xgc 2005-12-10
  • 打赏
  • 举报
回复
救救俺啊~~~
gavin_xgc 2005-12-09
  • 打赏
  • 举报
回复
没错,我就是从这个文档看了写的,但是照抄后发现在C#里出错!!
JzeroBiao 2005-12-09
  • 打赏
  • 举报
回复
ODBC


Standard Sybase System 12 (or 12.5) Enterprise Open Client:

"Driver={SYBASE ASE ODBC Driver};Srvr=Aron1;Uid=username;Pwd=password"



Standard Sybase System 11:

"Driver={SYBASE SYSTEM 11};Srvr=Aron1;Uid=username;Pwd=password;"
Do you know a userguide for Sybase System 11, 12, 12.5? E-mail the URL to connectionstrings.com now!! >>
Intersolv 3.10:

"Driver={INTERSOLV 3.10 32-BIT Sybase};Srvr=Aron1;Uid=username;Pwd=password;"



Sybase SQL Anywhere (former Watcom SQL ODBC driver):

"ODBC; Driver=Sybase SQL Anywhere 5.0; DefaultDir=c:\dbfolder\;Dbf=c:\mydatabase.db;Uid=username;Pwd=password;Dsn="""""
Note! The two double quota following the DSN parameter at the end are escaped quotas (VB syntax), you may have to change this to your language specific escape syntax. The empty DSN parameter is indeed critical as not including it will result in error 7778.

Read more in the Sybase SQL Anywhere User Guide >>
OLE DB


Adaptive Server Anywhere (ASA):

"Provider=ASAProv;Data source=myASA"
Read more in the ASA User Guide >>
Adaptive Server Enterprise (ASE) with Data Source .IDS file:

"Provider=Sybase ASE OLE DB Provider; Data source=myASE"
Note that you must create a Data Source .IDS file using the Sybase Data Administrator. These .IDS files resemble ODBC DSNs.
Adaptive Server Enterprise (ASE):

"Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDBname;User Id=username;Password=password"
- some reports on problem using the above one, try the following as an alternative -

"Provider=Sybase.ASEOLEDBProvider;Server Name=myASEserver,5000;Initial Catalog=myDBname;User Id=username;Password=password"
This one works only from Open Client 12.5 where the server port number feature works,燼llowing fully qualified connection strings to be used without defining燼ny .IDS Data Source files.
AseConnection (.NET)


Standard:

"Data Source='myASEserver';Port=5000;Database='myDBname';UID='username';PWD='password';"



Declare the AseConnection:

C#:
using Sybase.Data.AseClient;
AseConnection oCon = new AseConnection();
oCon.ConnectionString="my connection string";
oCon.Open();



VB.NET:
Imports System.Data.AseClient
Dim oCon As AseConnection = New AseConnection()
oCon.ConnectionString="my connection string"
oCon.Open()



110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧