?
Solved

cant bind datagrid

Posted on 2004-11-24
5
Medium Priority
?
298 Views
Last Modified: 2010-04-23
tring to bind a datagrid with the following code and I recevie a message that databind is not a member of system.windows.forms.datagird.

heres the code.

 myConn.ConnectionString = m_ConnectString
        mySQL = "SELECT * from users"
        myCommand = New SqlCommand(mySQL, myConn)
        myConn.Open()

        myDA.SelectCommand = myCommand
        myDA.Fill(myDS)
        myConn.Close()
        DataGrid1.DataSource = myDS.Tables(0)
        DataGrid1.DataBind()
0
Comment
Question by:mgmhicks
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 12669094
DataBind is a Web Datagrid member. Simply setting the DataSource property should be enough
0
 
LVL 9

Expert Comment

by:caball88
ID: 12669103
you only to use databind for asp.net applications. for a winforms application it is not necessarry to call that function(doesn't even exist)
0
 

Author Comment

by:mgmhicks
ID: 12669112
So how do I fill a grid with data from a dataset?  In Code of course.

0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12669122
you already did it


myConn.ConnectionString = m_ConnectString
        mySQL = "SELECT * from users"
        myCommand = New SqlCommand(mySQL, myConn)
        myConn.Open()

        myDA.SelectCommand = myCommand
        myDA.Fill(myDS)
        myConn.Close()
        DataGrid1.DataSource = myDS.Tables(0)


that is it
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 12669129
Exactly like you did except for the DataBind method
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

750 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