Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a VB 6 Code i just want to convert this code to Stored procedure
please help me out i need to send this MSFlx as a Parameter plz help me out


VB
Set RsSa = DB.OpenRecordset("select * from SALES where invno =" & Val(INVNOTXT.Text) & "", dbOpenDynaset)
L = 1
Do While L <= 10
    If Trim(MSFLX1.TextMatrix(L, 1)) <> "" Then
        RsSa.AddNew
            RsSa!InvNo = Val(INVNOTXT.Text)
            RsSa!InvDt = CDate(INVDATETXT.Text)
            RsSa!Sno = L
            RsSa!InvType = Stype
            RsSa!Units = UCase(Trim(MSFLX1.TextMatrix(L, 2)))
            RsSa!Qty = Val(MSFLX1.TextMatrix(L, 3))
            RsSa!Rate = MSFLX1.TextMatrix(L, 4)
            If Trim(MSFLX1.TextMatrix(L, 5)) <> "" Then RsSt!Remarks = Trim(MSFLX1.TextMatrix(L, 5))
        RsSa.Update
    End If
    L = L + 1
Loop
Posted
Updated 26-May-11 19:40pm
v6

This code is updating rows in a table with data from an MSFlexGrid control. If you want to change this to a stored procedure, you can update only one row at a time by calling the stored procedure.

SQL
CREATE PROCEDURE UpdateInvoice (
InvNo varchar,
InvValue float,
............
)
AS
BEGIN

UPDATE Invoice SET InvValue = @InvValue, .......
WHERE InvNo = @InvNo

END


and then call this stored procedure from your code and pass on the parameters.
 
Share this answer
 
Here's a good CP Article to read Overview of a Stored Procedures[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900