what is the pseudo code to get data from the database and view it in your application??

Recommended Answers

All 8 Replies

//sql query
string query = "SELECT * FROM MyTable";
//create connection
SqlConnection sqlConn = new SqlConnection("connString");
//create command
SqlCommand cmd  = new SqlCommand(query, sqlConn);
//create dataAdapter
SqlDataAdapter da = new SqlDataAdapter(cmd);
//Create DataTable:
DataTable table = new DataTable("MyTable");
//fill table:
da.Fill(table);

//to show in your application there is many ways, one is to bind the table with a control (most common is the DataGridView control):
dataGridView1.DataSource = new BindingSource(table, null);

thanks mitja ;) now i'll try to convert it into a pseudocode ! :/

can you give me the pseudo code pls ?

Which pseudo code? I dont understand.

pseudo code is like an algorithm but it will be more base on code of how to get data from data base.. a step by step PSEUDO CODE , not CODE

I really dont know what you mean. I gave you the code, step by step. I dont know what would you like to have more - this is it mate!
If you would have any example about what you are talking, it would be easier....

.

Iam sure this is some homework. So try to do it by your self mate. I gave you all the code and even commented it. If you know how to read the code, you can do the pseudo by your self (but I know you can read it correctly - its not a big deal).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.