国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

解決一個.NET聯接SQL的問題 yiyang(轉貼)

2024-07-10 13:08:06
字體:
來源:轉載
供稿:網友


解決一個.net聯接sql的問題    yiyang(轉貼)  
  
關鍵字     .net
  
出處     http://ouynagouyang
  


imports system.data
imports system.data.sqlclient
imports system.data.sqlclient.sqlexception
public class connect
    private s as string
    private s1 as string
    public connect as new sqlconnection("server=yiyang;database=kderp;uid=sa;password=123")
    sub new()
        connect.open()
    end sub
    public property sql()
        get
            return s
        end get
        set(byval value)
            s = value
        end set
    end property
    'public property table()
    '    get
    '        return s1
    '    end get
    '    set(byval value)
    '        s1 = value

    'end property
    public function retable() as datatable

        dim com as new dataset()

        dim ada as new sqldataadapter()
        dim com1 as new sqlcommand()
        com1.connection = connect
        com1.commandtext = s
        ada.selectcommand = com1
        ada.fill(com, "t1")
        return com.tables(0)

    end function
    public function exec() as integer
        dim i as integer

        dim com as new sqlcommand()
        com.commandtext = s
        com.connection = connect
        i = com.executenonquery()
        return i
    end function
    public function retdataset(byval t as string) as dataset

        dim com as new sqlcommand()
        com.connection = connect
        com.commandtext = s
        dim ada as new sqldataadapter()
        ada.selectcommand = com
        dim da as new dataset()
        ada.fill(da, t)
        return da
    end function
    public function retdataread() as sqldatareader

        dim com as new sqlcommand()
        com.connection = connect
        com.commandtext = s
        return com.executereader
    end function
end class


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 竹溪县| 渝中区| 南靖县| 思茅市| 辽中县| 文安县| 武冈市| 晋江市| 连江县| 新建县| 拜泉县| 永德县| 抚远县| 洱源县| 无锡市| 望城县| 上杭县| 中宁县| 通榆县| 郧西县| 武冈市| 屯昌县| 师宗县| 曲松县| 儋州市| 彭州市| 纳雍县| 双柏县| 渑池县| 视频| 四子王旗| 全州县| 濮阳县| 陕西省| 云南省| 黔南| 泸西县| 陆川县| 南丹县| 阳江市| 宁化县|