Click here to Skip to main content
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 4: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 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
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