Solved

how retrieve data acccess db with c#

Posted on 2012-03-23
2
243 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
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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

770 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