hi,

i am doing a project using C#. i haven't much knowledge in C#.
i stored some information in Dataset like named as (Table).
i do't know how to collect the data from dataset(like Table) using DML (query).
i do't know about the connection information.

please kindly provide the notes and coding


Thanks & Regards,

Karthikeyan S

If you stored your information in a DataSet, what is the problem with retrieving that information?

What code do you have that doesnt work?

hi,


i like to retrieve data using DML. currently we collects the data from dataset using datarow. instead of using datarow i like to use DML for collect the data from dataset table.

If you stored your information in a DataSet, what is the problem with retrieving that information?

hi

i am stored some information in dataset. i like to reterive that data from dataset by using query.
i m new to .net area. so i m not able to get clear idea about that operation. please send the details to me.

Regards,
Karthikeyan S

As asked before.
What code do you have that doesnt work ?

As asked before.
What code do you have that doesnt work ?

i do't know how to write the code for the above.

task is : some information stored in dataset. now to reterive that information through the DML (query). i do't know how to write this code. i am searched in google. may peoble says it is possible. but no other information got from google then i do't know how to write the program for this one.

for db operation we create the connection and pass the query and connection then we reterive the db information. but in dataset how is it possible . please give some information or code regarding this topic

We will help you, but we wont write anything for you. google, has nearly all the answers you could need. Have a look.

hi i try to search in google. but information not available.

key word is : how to retrieve data from data set using DML query.

and
how to access the dataset information using DML query

mostly i got my question post. ie this site only.

no other relevant information in m not getting.
if u getting please send that link. its really helpful for me.

Regards,
Karthikeyan s

Try just "DML c#" comes back with a lot of info

Iterating through the DataSet:

Here is a simple code to iterate through the dataset and select individual items instead of selecting all the data in the DataSet.

SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROm Categories",myConnection);

DataSet ds = new DataSet();

ad.Fill(ds,"Categories");

DataTable dt = ds.Tables["Categories"];


Response.Write(dt.Rows[0][1].ToString()) ;

1) First few lines are identical which we have done before.

2) In the forth line we declared the DataTable object. DataTable object is used to hold a single table. As I already told you that dataset can hold multiple tables depending upon the query so we can assign a single table from the dataset to the datatable object. I have done that using the line.

DataTable dt = ds.Tables["Categories"];

3) Next we are printing the first row of the second column. Always remember that the number of the rows and columns in the database does not start with 1 but it starts at 0. So in this line of code:

Response.Write(dt.Rows[0][1].ToString()) ;

This line of code means that get Row '0' and Column 1 of the from the datatable. And so we get the value and it prints out "Beverages".

Saving dataSets in Session State:

DataSets can also be saved in the Session State so that it can be available in other areas of the application and in new pages. The way of storing the DataSet in Session State is very easy.

Session["MyDataSet"] = DataSet;

Later if you want to retrieve the DataSet from the Session State you can easily do this by using this line of code:

DataSet ds = (DataSet) Session["MyDataSet"]

As you can see that when I am retrieving the values from the Session object I am casting it into the dataset object. This is because this is explicit conversion and requires casting. I am unboxing in this case.

hi currently i m using.

connection=new oledbconnection(oracle connection);
connection.open();
command=new oledbcomman("select * from table_name");
adapter=new oledbdataadapter(command);
adapter.fill(dataset,"Tableinfo");


now i need to get the data from the dataset using only DML.

i tried the following coding but its not working.

conn= new oledbconnection("Provider=SQLOLEDB; server=(local);integrated security=SSPI; database=northwind");
conn.open(); // exception occur in this place.

command = new oledbcommand("Select column from Tableinfo", conn);
.......................

please give an idea i tried many times and still i m face the problem.........

We will help you, but we wont write anything for you. google, has nearly all the answers you could need. Have a look.

hi currently i m using.

connection=new oledbconnection(oracle connection);
connection.open();
command=new oledbcomman("select * from table_name");
adapter=new oledbdataadapter(command);
adapter.fill(dataset,"Tableinfo");


now i need to get the data from the dataset using only DML.

i tried the following coding but its not working.

conn= new oledbconnection("Provider=SQLOLEDB; server=(local);integrated security=SSPI; database=northwind");
conn.open(); // exception occur in this place.

command = new oledbcommand("Select column from Tableinfo", conn);
.......................

please give an idea i tried many times and still i m face the problem.........

The only easiest method is
LINQ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.