Click here to Skip to main content
15,921,062 members
Home / Discussions / C#
   

C#

 
GeneralListing all machines in the network Pin
AnsGe23-Aug-05 23:06
AnsGe23-Aug-05 23:06 
GeneralRe: Listing all machines in the network Pin
zagzagzag24-Aug-05 5:19
zagzagzag24-Aug-05 5:19 
GeneralC#, Fortran and dll's Pin
Kash23-Aug-05 22:55
Kash23-Aug-05 22:55 
GeneralRe: C#, Fortran and dll's Pin
leppie24-Aug-05 1:09
leppie24-Aug-05 1:09 
Generalhelp me please i really cant solve it Pin
nidhelp23-Aug-05 21:50
nidhelp23-Aug-05 21:50 
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 
That is what the code I gave you does. It sends the query to the database and retrieves the result. Here is again, but annotated more fully.

// Create and Open the connection to the database
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
myConnection.Open();
 
// Define the command to send to the database.
OleDbCommand cmd = new OleDbCommand(myConnection,
     "SELECT id, dataColumn1, dataColumn2, etc FROM myTable WHERE id = ?");
cmd.Parameters.Add(id);
 
// Execute the commend, requesting a reader object to get the results.
OleDbDataReader reader = cmd.ExecuteReader();
 
// Get the results from the reader 
int id = reader.GetInt32(0);
string myValue = reaser.GetString(1); // etc.
 
// Close the connection.
myConnection.Close();


Also, the MSDN documentation will explain each of these classes and methods with further examples.

* DISCLAIMER: I typed this by hand without running it through a compiler. There may be some small errors.


My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More


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 
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 

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.