Data View Controls...?  
Author Message
Yasir Imran





PostPosted: ASMX Web Services and XML Serialization, Data View Controls...? Top

HI,

Data Controls in ASP like [GridView,FormView,DetailView] display data from a database, SQL Server or Access, they display all the data in a tabuler format.

If we want to access any specific row or cell from a database, how can it will be accomplished

As I have a little knowledge in Classic ASP, we use Recordsets & to access data we do like rs(0) , rs(1) & rs(i)




.NET Development31  
 
 
rfreire





PostPosted: ASMX Web Services and XML Serialization, Data View Controls...? Top

Well, now you will have to use ADO.NET.....

It is quite similar to classic ASP.... for example:

private static void ReadOrderData(string connectionString)
{
string queryString =
"SELECT OrderID, CustomerID FROM dbo.Orders;";
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(
queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
Console.WriteLine(String.Format("{0}, {1}",
reader[0], reader[1]));
}
}
finally
{
// Always call Close when done reading.
reader.Close();
}
}
}

Rgds

Rodrigo


 
 
Yasir Imran





PostPosted: ASMX Web Services and XML Serialization, Data View Controls...? Top

O, Thank you

I'll try this, I hope so it will work