Hello:
This question is specific to theLizard:
Here is my ClassDB. In the LoadListBox routine, I had to leave a few lines in. If I took them out, it stopped working. It took me a long time to get it to work because of a bug I created.
The lines that you wanted me to take out. I moved them into the Connection() and now I can remove them. Its cool, I am learning slowly but surely.
//DBDataAdapter = SetupDataAdapter();
//DBDataAdapter.SelectCommand = DBCommand;
//DBDataAdapter.SelectCommand.Connection = DBConnection;
Loading

theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 4:49 PM EDT
//DBDataAdapter = SetupDataAdapter(); this is ok in Connection();
these should be a do as needed only, what I mean by this is that you should only use these in functions if you need to otherwise ignore them.
//DBDataAdapter.SelectCommand = DBCommand;
//DBDataAdapter.SelectCommand.Connection = DBConnection;
see attached zip.
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 4:52 PM EDT
OK, I see now about the other 2 lines. I should of not put them there becasue they will be execute every time when I do the Connect();. I will put them back where they where.
theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 4:54 PM EDT
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 5:03 PM EDT
Ok, I put that: public SqlDataAdapter SqlAdapter
And took out the Close().
theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 5:11 PM EDT
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 5:13 PM EDT
Yes... I thought it was those only 2, but that I expanded it and saw the other stuff. I implemented it and tested it and it still works.
theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 5:30 PM EDT
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 5:32 PM EDT
It does not like the 2 definitions of 'sql'
//public string sql;
private string sql;
public string sql
{
get { return (dBConnect); }
set { dBConnect = value; }
}
theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 5:40 PM EDT
You can put that back to DBCommand
Also, this MUST be public.
there are things in the class that need to be public.
prib=vate string sql --> private string dBConnect
public string sql --> public string DBConnect
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 5:43 PM EDT
OK, I will intergrate the changes manually. Give me a few minutes.
theLizardRank #1,079 · 1.8K reputationPosted Mar 20, 2010, 5:54 PM EDT
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 5:57 PM EDT
No problem. I just finished testing it and it works now. I will study the code.
GustavoRank #1,990 · 732 reputationPosted Mar 20, 2010, 6:28 PM EDT
In case you need a new copy of ClassDB, here it is.