DataSet ds = new DataSet();
string con = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DBFileName;
System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Products", con); dlg.Caption = "Loading Products...";
oleDbDataAdapter.Fill(ds, "Products");
CurrentGrid.DataSource = ds.Tables["Products"].DefaultView;这个是针对accece数据库的datagrid榜定现在有一个Sql数据库 同样的东西应该怎么写呢!!?

解决方案 »

  1.   

    value="data source=wuhanyong;initial catalog=jxc;persist security info=False;user id=sa;password=passed;workstation id=wuhanyong;packet size=4096"
      

  2.   

    修改连接串con="data source=ddy;initial catalog=ls;persist security info=False;user id=sa;workstation id=LZF;packet size=4096"
      

  3.   

    DataSet ds = new DataSet();
    string con = "Provider=Microsoft.Jet.OLEDB.4.0;Data data source=127.0.0.1;initial catalog=CALLTHINK;persist security info=False;user id=sa;password=sa;";
    System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter("select * from SMS_USER", con);
    oleDbDataAdapter.Fill(ds,"SMS_USER");
    这个是我的语句!在最后那里会报错!怎么回事!?
      

  4.   

    data source=机器名 catalog=数据库名
    还有连接SQL数据库不能用oleDbDataAdapter 要用SqlDataAdapter