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
theLizardPosted Mar 20, 2010, 8:49 PM
//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.
GustavoPosted Mar 20, 2010, 10:28 PM
In case you need a new copy of ClassDB, here it is.
GustavoPosted Mar 20, 2010, 9:57 PM
No problem. I just finished testing it and it works now. I will study the code.
theLizardPosted Mar 20, 2010, 9:54 PM
GustavoPosted Mar 20, 2010, 9:43 PM
OK, I will intergrate the changes manually. Give me a few minutes.
theLizardPosted Mar 20, 2010, 9:40 PM
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
GustavoPosted Mar 20, 2010, 9:32 PM
It does not like the 2 definitions of 'sql'
//public string sql;
private string sql;
public string sql
{
get { return (dBConnect); }
set { dBConnect = value; }
}
theLizardPosted Mar 20, 2010, 9:30 PM
GustavoPosted Mar 20, 2010, 9:13 PM
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.
theLizardPosted Mar 20, 2010, 9:11 PM
GustavoPosted Mar 20, 2010, 9:03 PM
Ok, I put that: public SqlDataAdapter SqlAdapter
And took out the Close().
theLizardPosted Mar 20, 2010, 8:54 PM
GustavoPosted Mar 20, 2010, 8:52 PM
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.