How to use the stored procedure in ASP.NET (VB.NET)

zhaozj2021-02-16  46

The method of use in the ASP.NET (VB) storage process (the same is basically the same as the SQL statement directly, the difference is the red font part)

'Connecting Database (Link Database Using UDL)

Dim dbpath as string = server.mappath ("conn) DIM CONN AS OLEDBCONNECTION = New OLEDBCONNECTION (" File Name = "& dbpath) Conn.Open ()

'Stored procedure name: yw_hrhsxx_1

Dim prostr as string = "yw_hrhsxx_1 ('2003', '01', 1, 1, 1, 1, '2003-02-08', 'HDDD', '1', '2', '3', '4 ',' 1 ',' 2 ',' 3 ',' 4 ',' 1 ',' 2 ') "

'Define execution objects

CMD = New OLEDBCOMMAND (Prostr, Conn)

'Set the execution statement type as the stored procedure

Cmd.commandtype = commandtype.storedProcedure

'Perform a stored procedure

Cmd.executenonquery ()

Cmd.connection.close ()

CONN.CLOSE ()

转载请注明原文地址:https://www.9cbs.com/read-25692.html

New Post(0)