Monday, March 12, 2012

Pls Help... How can I retieve the value of fields in my sqldatabase using sqldatareader

Please help me with my thesis... I am using ASP.NET

How can I retieve the value of fields in my sqldatabase using sqldatareader

thnks

Try the training videos in the SQL section.....http://www.asp.net/learn/sql-videos/

These will help you get started learning how to retreive data from the database

Burl

|||Dim DBConnAsNew SqlConnection("Server=localhost;Password=YourPWD;Persist Security Info=False;User ID=YourID;Initial Catalog=Northwind;Data Source=YourDataSource")Dim DBCmdAsNew SqlCommandDim DRAs SqlDataReaderDBCmd =New SqlCommand("SELECT Id, Name FROM Customers WHERE CustomerID = @.CustomerID", DBConn)DBCmd.Parameters.Add("@.CustomerID", SqlDbType.NChar, 5).Value = txtQuery.TextDR = DBCmd.ExecuteReader()

While(DR.Read())
{
id as string = DR["ID"].ToString()
}

|||

Hey it is good to read the DataTable values from Data Reader. Try using the linkhttp://dotnetsavvyblog.blogspot.com/2007/11/to-retrieve-fields-using-sqlreader.html.

Do let me know if you still face problems.

No comments:

Post a Comment