C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

hi...whats the error in code..plz help...DAtaset


Posted Date: 03 Jul 2008      Posted By: juhee      Member Level: Gold     Points: 1   Responses: 1



foreach(DataRow d in myDataSet.Tables["myTable"].Rows)
{
myDataSet.Tables["myTable"].Rows["chdrnum"].BeginEdit();
myDataSet.Tables["myTable"].Rows["chdrnum"] = j;
myDataSet.Tables["myTable"].Rows["chdrnum"].EndEdit();

}





Responses

Author: Shivshanker Cheral    03 Jul 2008Member Level: DiamondRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

Where you are using d??

so no need of foreach loop if you want access directly with table name and column name

refer


using System;
using System.Data;
using System.Data.SqlClient;

class MainClass
{
static void Main(string[] args)
{
string connString = @"server = .\sqlexpress;integrated security = true;database = northwind";
string sql = @"select productname,unitprice from products where unitprice < 20";
SqlConnection conn = new SqlConnection(connString);
try
{
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow row in dt.Rows)
{
foreach (DataColumn col in dt.Columns)
Console.WriteLine(row[col]);
}
}
catch(Exception e)
{
Console.WriteLine("Error: " + e);
}
finally
{
conn.Close();
}
}
}




Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : parameter field in crystal report
Previous : what is meant by caching,how we can impliment asp.net & C#.net
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use