2009年8月6日 星期四

VB.NET 操作 MSSQL SP 語法

Dim Conn As SqlConnection = New SqlConnection("Data Source=xxx.xxx.xxx.xxx;Initial Catalog=DATABASE name;User ID=XXX;Password=xxxxxxxx")
Dim Comm As SqlCommand = New SqlCommand("SP_InsertEvent", Conn)
Comm.CommandType = Data.CommandType.StoredProcedure
Comm.Parameters.AddWithValue("@Yym", Session("currYYM"))
Comm.Parameters.AddWithValue("@Code", "Q456")
Comm.Parameters.AddWithValue("@Name", "現在五點")
Comm.Parameters.AddWithValue("@BeginDate", "2009/08/06")
Comm.Parameters.AddWithValue("@EndDate", "2009/08/06")
Comm.Parameters.AddWithValue("@Description", "現在五點")
Comm.Parameters.AddWithValue("@PsnNo", "7777777")
Conn.Open()
Comm.ExecuteNonQuery()\\沒有回傳值
Conn.Close()

沒有留言:

張貼留言