?
Solved

how retrieve data acccess db with c#

Posted on 2012-03-23
2
Medium Priority
?
253 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 1500 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

771 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