vb 2010,使用sql server 2008的数据集 [英] vb 2010, dataset using sql server 2008

查看:56
本文介绍了vb 2010,使用sql server 2008的数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集[必须]来自我的电脑,我这里有2个表并且已经包含很多查询,所以我的问题现在,我们的教练想要一个集中数据库,这意味着我们将使用其他电脑的数据库,虽然我仍然使用相同的数据库和相同的表,也称为[必须],通过局域网,我可以连接到该服务器并通过SQL使用相同的数据库,我现在的问题是,我将如何仍然能够维护我的数据集和它的查询,因为删除我现有的数据集并将相同的数据集连接到新服务器也将删除我所做的所有查询,请帮忙,做什么是正确的,谢谢

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

推荐答案

使用数据集来获取后面的列和代码以保存查询。例如:



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>


这篇关于vb 2010,使用sql server 2008的数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆