2006-11-08

 

Asp.Net2.0 StoredProcedure and Parameter

Dim cn As New SqlConnection("Server=localhost;Database=Northwind;UID=sa;PWD=P@ssw0rd;")
Dim cmd As New SqlCommand("SalesByCategory", cn)
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@CategoryName", TextBox1.Text)

cn.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
dr.Read()
Response.Write(dr(0))

dr.Close()
cn.Close()

Comments: 張貼留言



<< Home

This page is powered by Blogger. Isn't yours?