C#的有关问题this.da.Fill(ds,tempTableName);
using System;using System.Data;
using System.Data.SqlClient;
namespace 进销存管理系统
{
public class LinkDataBase
{
private string strSQL;
private string connectionString = "workstation id=localhost;
Integrated Security=SSPI;database=jxcbook";
private SqlConnection myConnection;
private SqlCommandBuilder sqlCmdBld;
private DataSet ds = new DataSet();
private SqlDataAdapter da;
public LinkDataBase()
{//
// TODO: 在此处添加构造函数逻辑
//
}
//根据输入的SQL语句检索数据库数据
public DataSet SelectDataBase(string tempStrSQL,string tempTableName)
{
this.strSQL = tempStrSQL;
this.myConnection = new SqlConnection(connectionString);
this.da = new SqlDataAdapter(this.strSQL,this.myConnection);
this.ds.Clear();
这句是断点处即错误:this.da.Fill(ds,tempTableName);
return ds;//返回填充了数据的DataSet,其中数据表以tempTableName给出的字符串命名
}
public DataSet UpdateDataBase(DataSet changedDataSet,string tableName)
{
this.myConnection = new SqlConnection(connectionString);
this.da = new SqlDataAdapter(this.strSQL,this.myConnection);
this.sqlCmdBld = new SqlCommandBuilder(da);
this.da.Update(changedDataSet,tableName);
return changedDataSet;//返回更新了的数据库表
}
public DataTable SelectDataBase(string tempStrSQL)
{
this.myConnection = new SqlConnection(connectionString);
DataSet tempDataSet = new DataSet();
this.da = new SqlDataAdapter(tempStrSQL,this.myConnection);
this.da.Fill(tempDataSet);
return tempDataSet.Tables[0];
}
public int UpdateDataBase(string tempStrSQL)
{
this.myConnection = new SqlConnection(connectionString);
myConnection.Open();
SqlCommand tempSqlCommand = new SqlCommand(tempStrSQL,this.myConnection);
int intNumber = tempSqlCommand.ExecuteNonQuery();
myConnection.Close();
return intNumber;
}
}
}
this.da.Fill(ds,tempTableName); 这句出错了!
我是新手请大哥大姐高手们帮帮看一下哪里出了问题
[img=http://photo.store.qq.com/http_imgload.cgi?/rurl2=b29e061b4744f7f5c0ec2531357f8e0297a04f13efc35fded95b7e2444ea7375a67cc0149a84c40a728dcd5de95acd62bc53188ff054b32957a9cd21bfbc1e671e5aa20f652ca74837a9a62baebcce4d39786bfc][/img]
补充:.NET技术 , C#