Asp.net连接Sql数据库的语法例子

Dim myConnection As SqlClient.SqlConnection
        Dim myCommand As SqlClient.SqlCommand
        Dim myReader As SqlClient.SqlDataReader
        Dim strSql As String
        Dim ConnStr As String

        strSql = "SELECT P_NAME FROM M_PLOR"
        ConnStr = "server=WHATEVER;packet size=4096;user id=sa;password="sa";data source=ISO2;persist secu" & _
                    "rity info=False;initial catalog=wuye"

        myConnection = New SqlClient.SqlConnection(ConnStr)
        myConnection.Open()
        myCommand = New SqlClient.SqlCommand(strSql, myConnection)

        myReader = myCommand.ExecuteReader

        Dim n As Integer
        n = myReader.FieldCount

        Dim str As String


        ShipMethod.DataSource = myReader
        ShipMethod.DataBind()

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页