Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Running stored procedures/copying results in VB.net
Message
De
21/09/2011 14:47:23
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01524129
Message ID:
01524190
Vues:
38
>>>>Can you control that stuff in VB? Have it output to some sort of unseen gridview and then copy it?
>>>
>>>To get result as dataset you can use two main methods - first is to ExecuteReader (this was in my link - I put comparision between 3 main methods) and second approach is to create dataset and use its Fill method to fill it with data.
>>>
>>>Start from reading on ExecuteReader.
>>
>>That I did read and I used that in the code:
>>
>>
SQLCmd = New SqlCommand("StandardNamesCount", SQLCon)
>>        SQLCmd.CommandType = CommandType.StoredProcedure
>>        SQLCmd.ExecuteReader()
>>
>>But that's when I couldn't figure out how to copy it to the clipboard from there, or if it would even copy in a gridview type style like I'm trying to do.
>>
>>Then I also did the gridview method and had it fill, but again, no idea how to copy the contents from there.
>
>Are you working with ASP.NET application or Windows forms? For the GridView Dataset is better - GridView will be based on DataSet.
>
>I have some old working code in ASP.NET I can probably share, but it's not something I can explain in few words - although you may also find samples on the Web of how to make an application (ASP.NET or Windows forms) using GridView.


Windows forms. I'm getting close now:
Me.StandardNamesCountTableAdapter.Fill(Me.TBLMasterDataSet.StandardNamesCount)
        Me.DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText
        Clipboard.SetDataObject(Me.DataGridView1.GetClipboardContent)
That copied the first cell of text, just not everything. All I need to figure out is how to select the entire DataGridView, which I think I saw somewhere.


EDIT: Here we go, this works:
DataGridView1.SelectAll()
        Dim content As DataObject = DataGridView1.GetClipboardContent()
        Clipboard.SetDataObject(content, True)
Thanks for the help :)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform