Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: help me please i really cant solve it Pin
Colin Angus Mackay23-Aug-05 22:39
Colin Angus Mackay23-Aug-05 22:39 
GeneralRe: help me please i really cant solve it Pin
nidhelp23-Aug-05 23:07
nidhelp23-Aug-05 23:07 
GeneralRe: help me please i really cant solve it Pin
Colin Angus Mackay23-Aug-05 23:15
Colin Angus Mackay23-Aug-05 23:15 
GeneralRe: help me please i really cant solve it Pin
nidhelp23-Aug-05 23:33
nidhelp23-Aug-05 23:33 
GeneralRe: help me please i really cant solve it Pin
Colin Angus Mackay23-Aug-05 23:52
Colin Angus Mackay23-Aug-05 23:52 
GeneralRe: help me please i really cant solve it Pin
nidhelp24-Aug-05 6:12
nidhelp24-Aug-05 6:12 
GeneralRe: help me please i really cant solve it Pin
Colin Angus Mackay24-Aug-05 13:13
Colin Angus Mackay24-Aug-05 13:13 
GeneralRe: help me please i really cant solve it Pin
tatchung24-Aug-05 15:23
tatchung24-Aug-05 15:23 
Hey! I've done something similar to this and i know just how you feel. My suggestion is that you separate your queries (data gathering from database) from you UI form. Create another form which would contain your connection string as well as all your queries then pass it to your main form.

Try this:


public class DS_Company<br />
{<br />
  OdbcConnection conn = new OdbcConnection("ConnectionString");<br />
  string strSQL;<br />
		<br />
  public DS_Company()<br />
  {<br />
  conn.Open(); //opens the database connection<br />
  }<br />
	<br />
  public DataSet GetID(string strID)<br />
  {<br />
  strSQL = " SELECT ";  //standard SQL command<br />
  strSQL += " * ";  //selects all the data in the table<br />
  strSQL += " FROM Table";  //what table you are aiming at<br />
  strSQL += " WHERE IDnumber='"+ strID +"'";  //gets data according to what ID you specify			<br />
<br />
  DataSet ds = new DataSet(); //creates a storage for your data<br />
  OdbcDataAdapter adpDS = new OdbcDataAdapter(strSQL,conn);  <br />
  adpDS.Fill(ds); //fills your dataset with the data<br />
  return ds; //passes the dataset to you main form<br />
  }<br />
}<code><br />
<br />
hope that helps <br />
<br />
Kampai!!!

GeneralRe: help me please i really cant solve it Pin
tatchung24-Aug-05 16:35
tatchung24-Aug-05 16:35 
GeneralRe: help me please i really cant solve it Pin
nidhelp24-Aug-05 20:24
nidhelp24-Aug-05 20:24 
GeneralRe: help me please i really cant solve it Pin
nidhelp24-Aug-05 23:39
nidhelp24-Aug-05 23:39 
AnswerRe: help me please i really cant solve it Pin
Muammar©11-Nov-06 21:18
Muammar©11-Nov-06 21:18 
GeneralListboxes to datasets Pin
towneytowney23-Aug-05 21:47
towneytowney23-Aug-05 21:47 
GeneralListboxes to datasets Pin
towneytowney23-Aug-05 21:46
towneytowney23-Aug-05 21:46 
GeneralSystem.NullReferenceException Pin
oneyard23-Aug-05 21:34
oneyard23-Aug-05 21:34 
GeneralRe: System.NullReferenceException Pin
Colin Angus Mackay23-Aug-05 21:50
Colin Angus Mackay23-Aug-05 21:50 
GeneralRe: System.NullReferenceException Pin
oneyard23-Aug-05 22:09
oneyard23-Aug-05 22:09 
GeneralRe: System.NullReferenceException Pin
Colin Angus Mackay23-Aug-05 22:17
Colin Angus Mackay23-Aug-05 22:17 
GeneralRe: System.NullReferenceException Pin
leppie23-Aug-05 21:57
leppie23-Aug-05 21:57 
GeneralRe: System.NullReferenceException Pin
Guffa23-Aug-05 22:14
Guffa23-Aug-05 22:14 
GeneralRe: System.NullReferenceException Pin
V.24-Aug-05 0:49
professionalV.24-Aug-05 0:49 
GeneralRe: System.NullReferenceException Pin
V.24-Aug-05 0:53
professionalV.24-Aug-05 0:53 
GeneralNetwork Management Pin
Member 199534123-Aug-05 21:27
Member 199534123-Aug-05 21:27 
QuestionHow to listen connection request on 80 port Pin
Gagan Deep Singla23-Aug-05 19:45
Gagan Deep Singla23-Aug-05 19:45 
AnswerRe: How to listen connection request on 80 port Pin
mav.northwind23-Aug-05 19:59
mav.northwind23-Aug-05 19:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.