开发者

ASP.NET Connection String Error

I used this connection to run my SQL query, but it did not work and sent this error:

Keyword not supported: 'dsn'

This is my connection:

public static string CnnStr = @"Dsn=Server;uid=kity;app=Microsoft® Visu开发者_运维知识库al Studio® 2010;wsid=kity;database=Server;trusted_connection=Yes";

This connection works for me in my datalist, but for my behind code it gives me this error. II should say that I used ODBC connection to database.


create any .udl file

press enter on it

detect your data source and copy and paste you Connection String in the asp.net code


Try adding a value for providerName=System.Data.Odbc into the connection string.

Like this:

@"Dsn=Server;uid=kity;app=Microsoft® Visual Studio® 2010;wsid=kity;database=Server;trusted_connection=Yes;providerName=System.Data.Odbc;"

If that doesn't work, take a look at the same question in different situations:

Keyword not supported exception when attempting to use a connection string that points to a ODBC DSN

Keyword not supported: 'dsn'

Note: the "Keyword not supported: ..." error usually comes from an incorrectly formatted connection string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜