简体   繁体   English

错误找不到数据源名称,并且在ADO.NET中没有使用Odbc指定默认驱动程序

[英]Error Data source name not found and no default driver specified with Odbc in ADO.NET

I'm having this error when i try to add some data from UI into MSSQL database and through all the questions&answers about this error i found, couldn't understand where the problem is. 当我尝试将UI中的一些数据添加到MSSQL数据库中并且通过关于所发现的关于此错误的所有问题和答案时,我遇到了此错误,无法理解问题出在哪里。 Could anyone give me some help? 谁能给我些帮助吗? Thanks. 谢谢。

OdbcConnection conexiune = new OdbcConnection("Data Source=CODRINMA\\codrinma;Initial Catalog=BD;Integrated Security=True");
conexiune.Open();
OdbcCommand cominsert = new OdbcCommand("insert into Tabela(idX,denumire,adresa,idY) values(?,?,?,?)", conexiune);
cominsert.Parameters.Clear();
cominsert.Parameters.AddWithValue("@idX", int.Parse(txtID.Text.Trim()));
cominsert.Parameters.AddWithValue("@denumire", char.ToUpper(txtDenumire.Text.Trim()[0]) + txtDenumire.Text.Trim().Substring(1));
cominsert.Parameters.AddWithValue("@adresa", char.ToUpper(txtAdresa.Text.Trim()[0]) + txtAdresa.Text.Trim().Substring(1));
cominsert.Parameters.AddWithValue("@idY", int.Parse(cmbCamp.SelectedValue.ToString()));
cominsert.ExecuteNonQuery();
MessageBox.Show("Message!!");
conexiune.Close();
this.Dispose();

"An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in System.Data.dll “ System.Data.dll中发生了'System.Data.Odbc.OdbcException类型的未处理的异常

Additional information: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" 其他信息:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序“

When using ODBC you need to include the driver to use in the connection string. 使用ODBC时,需要在连接字符串中包括要使用的驱动程序。

See OdbcConnection.ConnectionString . 请参阅OdbcConnection.ConnectionString

For instance if your server is SQL Server then add 例如,如果您的服务器是SQL Server,则添加

driver={SQL Server}

to the connection string. 连接字符串。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ODBC错误-找不到数据源名称,并且未指定默认驱动程序 - ODBC Error - Data source name not found and no default driver specified 我的SQL连接错误Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序 - My Sql Connection error Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 附加信息:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序 - Additional information: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ADODB连接-错误:找不到数据源名称,并且未指定默认驱动程序 - ADODB Connection - Error: Data source name not found and no default driver specified “未找到数据源名称且未指定默认驱动程序”错误 - “Data source name not found and no default driver specified” error 从C#通过ODBC访问Sql Server:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序 - Access to Sql Server via ODBC from C# : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 未找到数据源名称且未指定默认驱动程序 - Data source name not found and no default driver specified 未找到数据源名称且未指定默认驱动程序 - Data source name not found and no default driver specified 如何摆脱错误:“.net中找不到数据源名称,没有指定默认驱动程序”? - How to get rid of the error: “Data source name not found and no default driver specified” in .net? “未找到数据源名称且未指定默认驱动程序”用于创建访问连接 - “Data source name not found and no default driver specified” for creating access connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM