Click here to Skip to main content
11,704,044 members (67,193 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB .NET
i have a dataset [MUST] from my pc, i have 2 tables here and already contains lots of queries, so my problem now, our instructor wants a centralize database, it means we will use the database from other pc, though ill still use the same database and the same tables, also named [MUST], through LAN, i can connect to that server and use the same database via sql, my problem now is that how will i still be able to maintain my dataset and its queries, because removing my existing dataset and connecting the same dataset to new server will also remove all the queries i made, please help, what is the right thing to do, thanks
Posted 19-Feb-13 3:21am
bibang281
Comments
Richard MacCutchan at 19-Feb-13 9:23am
   
Nothing should change. Your dataset is instantiated when you start your program, and it gets filled from the database. Whether that database is on your PC or a server makes no difference.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use dataset to grab column and code behind to hold your query. For example:

Dim myReport As New rpt01 'my report design
Dim strSQL As String
Dim dtTemp As New ds.dtrptDataTable 'datatable for your dataset
Dim OleDbConn As New OracleConnection(ConnString)
Dim OleDbCmd As New OracleCommand
Dim OleDbAdapter As New OracleDataAdapter
 
Try
    If OleDbConn.State = ConnectionState.Closed Then OleDbConn.Open()
 
    strSQL = "select * from yourtable"
 
    OleDbCmd.CommandText = strSQL
    OleDbCmd.Connection = OleDbConn
    OleDbAdapter.SelectCommand = OleDbCmd
    OleDbAdapter.Fill(dtTemp)
 
    'then bind to your datasource(report,column or anything). in my case, I bind with my report
myReport.DataSource = dtTemp
myReport.DataMember = dtTemp.TableName
Finally
    If OleDbConn.State = ConnectionState.Open Then OleDbConn.Close()
End Try
<pre>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 530
1 OriginalGriff 510
2 Sergey Alexandrovich Kryukov 421
3 Andy Lanng 294
4 F-ES Sitecore 220
0 OriginalGriff 8,744
1 Sergey Alexandrovich Kryukov 7,747
2 CPallini 5,107
3 Maciej Los 4,716
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100