ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedSource Error:
Line 41: // Put user code to initialize the page here
Line 42: dataSet11.Clear();不知道为什么连不上数据,,请高手指点?
Line 43: odbcDataAdapter1.Fill(dataSet11);
Line 44: }
Line 45:
Source File: c:\inetpub\wwwroot\webinterface\webform1.aspx.cs Line: 43
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedSource Error:
Line 41: // Put user code to initialize the page here
Line 42: dataSet11.Clear();不知道为什么连不上数据,,请高手指点?
Line 43: odbcDataAdapter1.Fill(dataSet11);
Line 44: }
Line 45:
Source File: c:\inetpub\wwwroot\webinterface\webform1.aspx.cs Line: 43
你连接数据库的代码呢。...............
{
// Put user code to initialize the page here
dataSet11.Clear();
odbcDataAdapter1.Fill(dataSet11);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.odbcConnection1 = new System.Data.Odbc.OdbcConnection();
this.odbcDataAdapter1 = new System.Data.Odbc.OdbcDataAdapter();
this.odbcSelectCommand1 = new System.Data.Odbc.OdbcCommand();
this.odbcInsertCommand1 = new System.Data.Odbc.OdbcCommand();
this.dataSet11 = new Webinterface.DataSet1();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
//
// odbcConnection1
//
this.odbcConnection1.ConnectionString = "MaxBufferSize=2048;FIL=MS Access;DSN=SCHED_OPTIMIZER_RB;PageTimeout=5;UID=admin;D" +
"BQ=C:\\Inetpub\\wwwroot\\rb_workord.mdb;DriverId=25";
this.odbcConnection1.InfoMessage += new System.Data.Odbc.OdbcInfoMessageEventHandler(this.odbcConnection1_InfoMessage_2);
//
// odbcDataAdapter1
//
this.odbcDataAdapter1.InsertCommand = this.odbcInsertCommand1;
this.odbcDataAdapter1.SelectCommand = this.odbcSelectCommand1;
this.odbcDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "nqry_Optimized_Schedule", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("PART_NO", "PART_NO"),
new System.Data.Common.DataColumnMapping("SHOP_NO", "SHOP_NO"),
new System.Data.Common.DataColumnMapping("OP_NO", "OP_NO"),
new System.Data.Common.DataColumnMapping("MACH_NO", "MACH_NO"),
new System.Data.Common.DataColumnMapping("LABOR", "LABOR"),
new System.Data.Common.DataColumnMapping("START", "START"),
new System.Data.Common.DataColumnMapping("STOP", "STOP"),
new System.Data.Common.DataColumnMapping("DUE_DATE", "DUE_DATE"),
new System.Data.Common.DataColumnMapping("QTY", "QTY"),
new System.Data.Common.DataColumnMapping("DEPT_NO", "DEPT_NO")})});
//
// odbcSelectCommand1
//
this.odbcSelectCommand1.CommandText = "SELECT PART_NO, SHOP_NO, OP_NO, MACH_NO, LABOR, START, STOP, DUE_DATE, QTY, DEPT_" +
"NO FROM nqry_Optimized_Schedule";
//
// odbcInsertCommand1
//
this.odbcInsertCommand1.CommandText = "INSERT INTO nqry_Optimized_Schedule(PART_NO, SHOP_NO, OP_NO, MACH_NO, LABOR, STAR" +
"T, STOP, DUE_DATE, QTY, DEPT_NO) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("PART_NO", System.Data.Odbc.OdbcType.NVarChar, 50, "PART_NO"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("SHOP_NO", System.Data.Odbc.OdbcType.NVarChar, 50, "SHOP_NO"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("OP_NO", System.Data.Odbc.OdbcType.NVarChar, 50, "OP_NO"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("MACH_NO", System.Data.Odbc.OdbcType.NVarChar, 50, "MACH_NO"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("LABOR", System.Data.Odbc.OdbcType.NVarChar, 50, "LABOR"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("START", System.Data.Odbc.OdbcType.DateTime, 0, "START"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("STOP", System.Data.Odbc.OdbcType.DateTime, 0, "STOP"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("DUE_DATE", System.Data.Odbc.OdbcType.DateTime, 0, "DUE_DATE"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("QTY", System.Data.Odbc.OdbcType.Int, 0, "QTY"));
this.odbcInsertCommand1.Parameters.Add(new System.Data.Odbc.OdbcParameter("DEPT_NO", System.Data.Odbc.OdbcType.SmallInt, 0, "DEPT_NO"));
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); }
#endregion private void odbcConnection1_InfoMessage(object sender, System.Data.Odbc.OdbcInfoMessageEventArgs e)
{
} private void odbcConnection1_InfoMessage_1(object sender, System.Data.Odbc.OdbcInfoMessageEventArgs e)
{
} private void odbcConnection1_InfoMessage_2(object sender, System.Data.Odbc.OdbcInfoMessageEventArgs e)
{
} private void odbcConnection2_InfoMessage(object sender, System.Data.Odbc.OdbcInfoMessageEventArgs e)
{
}
}
http://www.connectionstrings.com/