Shane

Shane

  • NA
  • 1
  • 0

DataAdapter.Fill() ending load code?

Oct 6 2009 9:46 PM

gday all.

basically im having problems with the following code...

...

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 'finishes' the load after here ***

return da;

}

...

The code seems to be ending the "load" phase at the marked line (marked with ***)

theres no error message, the program doesn't hang or anything... It just seems to be stopping the load there and displaying my form without any data in it.

Has anyone had this problem before? Can anyone help me fix it?

Also, can anyone tell me if the MSDN forums are down? i can't get to them for some reason...

Cheers in advance!

Answers (1)