Solved

how retrieve data acccess db with c#

Posted on 2012-03-23
2
246 Views
Last Modified: 2012-03-29
hi..

i'm making a web application in c# read access db this is my code:

        protected void Consultar_Click1(object sender, EventArgs e)
        {
            string sql = @"SELECT Id_Venta
                                  ,Id_Producto
                                  ,Cantidad
                                  ,Fecha_Venta
                                  ,Id_Cajero
                              FROM VENTAS
                              WHERE Id_Venta = @Id";

            string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\TOÑO\\daniel\\Database21.mdb";
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connectionString);
            System.Data.OleDb.OleDbDataAdapter myDataAdapter = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM VENTAS where ID_Venta = '" + "1" + "'", conn);
            System.Data.DataSet myDataSet = new System.Data.DataSet("VENTAS");
            myDataAdapter.Fill(myDataSet, "VENTAS");
           
            conn.Close();
           
            return ;





            }


someone can help me...i need to put data retrieved at textboxes, but i don't know wich stape missing

thanks a lot
0
Comment
Question by:tenriquez199
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
gery128 earned 500 total points
ID: 37766130
are you getting data in myDataSet?
If yes then you can easily access it through Table and row/column properties of the myDataSet.
the syntaxt is like this:
txtName.Text = myDataSet.Tables[0].Rows[0][0].ToString();

http://bytes.com/topic/c-sharp/answers/235606-c-how-get-value-dataset

http://www.velocityreviews.com/forums/t109472-accessing-a-value-from-a-dataset.html
0
 
LVL 1

Author Closing Comment

by:tenriquez199
ID: 37785065
thanks
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question