[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Export data

Posted on 2004-10-28
7
Medium Priority
?
267 Views
Last Modified: 2010-04-24
Hi all

Is it possible to export the "data" content  in a datagrid to a database-table.... where
the number of collums and collumnames in the datagrid are same as the table in the database.?

And if so... how can i do that

thank's in advance

rgds jens
0
Comment
Question by:vbturbo
[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
7 Comments
 
LVL 14

Expert Comment

by:ptakja
ID: 12441005
How did you get the data into the datagrid in the first place? Typically datagrids are bound to a DataTable or DataSet object .
0
 
LVL 4

Expert Comment

by:andrewharris
ID: 12441083
Datagrids have a Datasource property. If the datagrid is not bound tothe database, then you are still able to use the DataSource property to get the data in a number of forms. One of the MSDN examples is as follows:

Private Function GetDataSetFromDataSource() As DataSet
    ' Create a DataSet variable, and set it to the DataSource.
    Dim myDataSet As DataSet
    myDataSet = CType(dataGrid1.DataSource, DataSet)
    Return myDataSet
End Function 'GetDataSetFromDataSource

This dataset (or if you chose to use data table) can be used to do anumber of things to get the data into the database.

Andrew
0
 
LVL 18

Author Comment

by:vbturbo
ID: 12441384
Hi there

thanks for quick reply

Have load'ded the data in the datagrid from a dataset "the grid is not bound to a table"
Afterwards i have been filtering the grid and now i want export the filtered result in to a new
table in a access database  or better into a new dataset ex.... myDataSet

ill try your above mentioned code and get back ...



0
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!

 
LVL 18

Author Comment

by:vbturbo
ID: 12441736
Hi Andrew

did'nt have any succes with msdn suggestion so here is the code im useing

    Dim daprivatkunder As New OleDb.OleDbDataAdapter
    Dim dsprivatKlientAs New DataSet("Recordset")

 Private Sub cboadminstrtion_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboadminstrtion.SelectedIndexChanged


        Navnedata = cboadminstrtion.Text
        Call mySqlserver()
        If cbosøgeindex.Text <> "Søge parameter" Then
            Kundeidprivat = "x"
            strSQL = "SELECT * FROM Kundedata Where Kundeid like '" & Kundeidprivat & "%'"
            rst = con.Execute(strSQL)
            daprivatkunder.Fill(dsprivatKlient, rst, "Kundedata")

            DataGrid1.CaptionText = "Klient udvalg"
            DataGrid1.RowHeadersVisible = True
            DataGrid1.DataSource = dsprivatKlient
            DataGrid1.DataMember = "Kundedata"
        End If
    con.close
      End Sub

when im finished filtering the "dsprivatKlient/datagrid" i imagined that i could store/save the filteret
data into a new dataset

maybe you got a new suggestion..?

rgds jens
0
 
LVL 10

Assisted Solution

by:123654789987
123654789987 earned 120 total points
ID: 12442974
Why do you want to save the filtered data to a database?

If you are not making any modifications to the data in the datagrid then there are no changes to be sent to the database.

For sorting and filtering operations u can use the dataview.
Eg:

Private Sub SortByTwoColumns()
   ' Get the DefaultViewManager of a DataTable.
   Dim myDataView As DataView
   myDataView = DataTable1.DefaultView
   ' By default, the first column sorted ascending.
   myDataView.Sort = "State, ZipCode DESC"
End Sub

then u can use the dataview.Table property to get the inbound table from the dataview. U can then use this datatable to bind to the datagrid.
0
 
LVL 4

Accepted Solution

by:
andrewharris earned 180 total points
ID: 12443396
#$%^&*()

I just frigged up and lost the last lot of code I had done for you...Its late here and I need some sleep.

If you are still having issues in the morning I will re-post REALLY!!!! sorry:-(

Andrew
0
 
LVL 18

Author Comment

by:vbturbo
ID: 12443444
Hi there

worked another way around my problem

but any way thanks a lot

rgds jens
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 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