Retrieve data from Dataset

Posted by Murugavelmsc under ASP.NET on 2/8/2013 | Points: 10 | Views : 10848 | Status : [Member] | Replies : 5
Hi Expert,

I want to retrieve particular data row from dataset.

How I can do that.

Please help me.

Thanks,
Murugavel S

Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/



Responses

Posted by: Rameshrajendran on: 2/8/2013 [Member] Starter | Points: 25

Up
0
Down
How about using this line?

DataRow[] drRows = ds.Tables[0].Select(ds.Tables[0].Columns[1].ColumnName + " = 0");

You like,Please answer me
Have a happy coding.
http://dotnet--solutions.blogspot.in

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 2/8/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace DataView_RowFilter
{
public partial class Form1 : Form
{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
OleDbDataAdapter oledbda;
DataSet ds;

string str;
public Form1()
{
InitializeComponent();
}

private void btndisplayall_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from student";
com = new OleDbCommand(str, con);
oledbda = new OleDbDataAdapter(com);
ds = new DataSet();
oledbda.Fill(ds, "student");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "student";
con.Close();
}

private void btndisplay_Click(object sender, EventArgs e)
{
DataTable dt;
dt = ds.Tables["student"];
DataView dv = new DataView(dt);
dv.RowFilter = "sname='" + textBox1.Text + "'";
dataGridView1.DataSource = dv;
}
}
}


If this post helps you mark it as answer
Thanks

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kusumas on: 2/8/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

long CustomerId=0;
CustomerId=dsDataSet.Tables["CustomerDetailsTable"].Rows[0]["CustomerID"]

Thanks

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 2/28/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

tryt his code

DataSet ds1 = new DataSet();
ds1 = GetFileNames();

if (ds1.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds1.Tables[0].Rows.Count - 1; i++)
{

}
}

mark as if the answer if help.

Mark as Answer if its helpful to you

Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 2/28/2013 [Member] Starter | Points: 25

Up
0
Down
 SqlCommand cmd = new SqlCommand("select * from leavereminder", db.sqlcon);

SqlDataAdapter adp = new SqlDataAdapter(cmd);
Dataset ds = new Dataset();
adp.Fill(ds);
if (ds.Rows.Count > 0)
{
//square bracket contains the column name whose value u want to retrieve
if (ds.Rows[0]["status"].ToString() == "pending")
{
string femail= ds.Rows[0]["email"].ToString();
string name = ds.Rows[0]["name"].ToString();

sendmail(ds.Rows[0]["email"].ToString(), ds.Rows[0]["name"].ToString());
}
else if (dt.Rows[0]["status"].ToString() == "approved")
{
sendmail(dt.Rows[0]["email"].ToString(), dt.Rows[0]["name"].ToString());

}

}


Murugavelmsc, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response