Click here to Skip to main content
16,006,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
Richard MacCutchan 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

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

VB
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>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900