Click here to Skip to main content
14,297,247 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have two tables
one emp and another dep
i want retrive one emp table values and another dept table values
in textboxes.
how can i do it in asp.net.
Posted
Updated 3-Feb-12 2:18am
v2
Comments
Anuja Pawar Indore 1-Feb-12 3:03am
   
Not clear... Elaborate
OriginalGriff 1-Feb-12 3:08am
   
And what is stopping you? Certainly I have no objections if you are seeking permission.
Use the "Improve question" widget to edit your question and provide better information.
Amir Mahfoozi 1-Feb-12 3:13am
   
Search the internet. There are many samples out there.
Sudip Saha 1-Feb-12 3:35am
   
Its a basic search in net how to connect data base using ADO.Net
   
Not a question. Go ahead, you got my approval. :-)
--SA
Rajesh Anuhya 1-Feb-12 4:31am
   
not clear
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Try query Select column1, column2 from table.
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

Basic stuff, search. Here's a simple example tho...

string commandText = "SELECT column1, column2 FROM MyTable Where Column1 IS NOT NULL"
var results = new DataSet();

var connectionString = ConfigurationManager
    .ConnectionStrings["MyConnectionStringName"].ConnectionString;

using (var connection = new SqlConnection(connectionString))
{
    connection.Open();
    using (var command = new SqlCommand(commandText, connection))
    {
        var adapter = new SqlDataAdapter(command);
        adapter.Fill(results);
    }
}

if (results.Tables.Count > 0)
{
    var firstTable = results.Tables[0];
    
    // Do something with the results
    foreach(var row in firstTable.Rows)
    {
        // do something??!
    }
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100