注册 登录
编程论坛 VB.NET论坛

求vb.net执行SQL方法!!

huwengui 发布于 2013-01-28 13:33, 576 次点击
dim sql as string="select * into #temp from AAA"
中如何写执行这段SQL ,最后数据库中才会有#temp 这个表
4 回复
#2
myhuangjin2013-02-16 19:49
sql
sqlCmd As New SqlCommand("", sqlCn)
dim strSql as string="insert into #tmp select * from TableA"
= strSql
sqlCmd.ExecuteNonQuery()
#3
pgjtz2013-11-12 01:07
Imports System.Data.SqlClient
Imports System.Data


Dim sqlconn As New SqlConnection
        Dim sqlcomm As New SqlCommand
        Dim connStr As String
        '应加上数据库服务器名,数据库名,数据库密码
        connStr = "Server=192.168.10.89;Database=dvr-data;user Id=sa;Password="
        sqlconn.ConnectionString = connStr

        '应加上数据库服务器测试,数据库名及数据库密码测试
        sqlconn.Open()
        sqlcomm.Connection = sqlconn
        Dim dataRd As SqlDataReader
         = CommandType.Text
        Dim commStr As String
        commStr = "SELECT DVR_Data.* FROM DVR_Data"
         = commStr
        sqlconn.Close()
        sqlconn.Open()
        dataRd = sqlcomm.ExecuteReader
#4
xiezhouyi2016-08-01 12:36
这样写如果换了数据库名称和电脑IP改变了怎么办
#5
xiezhouyi2016-08-01 12:36
这样写如果换了数据库名称和电脑IP改变了怎么办
1