 |
|
ท่านใดพอทราบวิธีเรียกใช้งาน Procedure ของ Oracle ผ่าน vb.net บ้างครับ |
|
 |
|
|
 |
 |
|
กลับมาตอบเองแล้วกัน เผื่อใครกำลังต้องการวิธี
ตาม Link เลยครับ
http://support.microsoft.com/kb/321718
|
 |
 |
 |
 |
Date :
2012-04-21 15:39:09 |
By :
koppy_golf |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตามนั้นครับ แค่เปลี่ยนตรง CommandType
Code (VB.NET)
Dim myCMD As New OracleCommand()
myCMD.Connection = Oraclecon
myCMD.CommandText = "curspkg_join.open_join_cursor1"
myCMD.CommandType = CommandType.StoredProcedure
myCMD.Parameters.Add(New OracleParameter("n_empno", OracleType.Number)).Value = 123
myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
http://support.microsoft.com/kb/321718
|
 |
 |
 |
 |
Date :
2012-04-21 22:26:09 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมยังติดอยู่อย่างหนึ่งคือ ถ้าเราจะเรียกใช้งาน Stored Procedure ที่เป็นคำสั่ง ประเภท Insert , update , delete จะต้องเขียนให้ VB.NET เรียกใช้ยังไง ถ้าไม่มี Parameter รับส่งค่าใน Procedure เพราะใช้ Procedure ที่มีคำสั่ง Select จะเรียกใช้งานได้
ส่วนตัว Procedure ที่ใช้คำสั่ง Insert , Update , Delete เมื่อลองเรียกใช้งานใน PL/SQL Developer ใช้งานได้ตามคำสั่ง แต่เรียกใน VB.NET ยังไม่ได้ครับ รบกวนท่านผู้รู้ชี้แนะแนวทางหรือขอดูตัวอย่างด้วยครับ
|
 |
 |
 |
 |
Date :
2012-04-22 08:20:35 |
By :
koppy_golf |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้แบบนี้ได้นะครับ เผื่อใครกำลังติดปัญหาแบบผม ลองนำไปประยุกต์ใช้ดูครับ
Code (VB.NET)
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Me.UseWaitCursor = True
Me.Cursor = Cursors.WaitCursor
Dim myCMD As New OracleCommand("pck_delete_insert_report", conn)
myCMD.Connection = conn
myCMD.CommandText = "pck_delete_insert_report.p_delete_insert"
myCMD.CommandType = CommandType.StoredProcedure
myCMD.Parameters.Add(New OracleParameter("cursor_cs", OracleType.Cursor)).Direction = ParameterDirection.Output
Try
conn.Open()
Dim myCMDReader As OracleDataReader = myCMD.ExecuteReader()
myCMDReader.NextResult()
Catch ex As Exception
System.Console.WriteLine("Exception: {0}", ex.ToString())
End Try
conn.Close()
End Sub
End Class
|
ประวัติการแก้ไข 2012-04-24 14:33:04
 |
 |
 |
 |
Date :
2012-04-24 14:31:42 |
By :
koppy_golf |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เยี่ยมครับ 
|
 |
 |
 |
 |
Date :
2012-04-24 18:12:48 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Good !
|
 |
 |
 |
 |
Date :
2012-11-08 14:00:55 |
By :
DD |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|