CSDN博客

img cmoremore

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

发表于2004/7/12 11:51:00  3409人阅读

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()

0 0

相关博文

我的热门文章

img
取 消
img