本文介绍了代码停止在DataAdapter.Fill行执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们,无法弄清楚为什么以下代码在标记的行(用***标记)上停止
hey guys, cant work out why the following code is stopping on the marked line (marked with ***)
...
namespace Keystore
{
public partial class FindKey : Form
{
public FindKey()
{
InitializeComponent();
}
DataSet ds;
System.Data.SqlClient.SqlDataAdapter da;
DatabaseHelper dataHelper = new DatabaseHelper();
DataRow dRow;
private void FindKey_Load(object sender, EventArgs e)
{
string sql = "SELECT * FROM Key";
string name = "AllKeys";
da = dataHelper.getAdapter(sql, name);
ds = dataHelper.getDataSet();
refreshList(1);
fillcboProvider();
fillcboProduct();
}
...
...
namespace Keystore
{
class DatabaseHelper
{
System.Data.SqlClient.SqlConnection con;
DataSet ds;
System.Data.SqlClient.SqlDataAdapter da;
public DatabaseHelper()
{
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\KeyStore.mdf;Integrated Security=True;User Instance=True";
ds = new DataSet();
}
public System.Data.SqlClient.SqlDataAdapter getAdapter(String sql, String name)
{
da = new System.Data.SqlClient.SqlDataAdapter(sql, con);
da.Fill(ds, name); *** Code stops executing after here ***
return da;
}
... <br />
推荐答案
这篇关于代码停止在DataAdapter.Fill行执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!