Click here to Skip to main content
15,888,238 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have this script in vb.net:

VB
For Each id As Object In Arguments.SelectedValues
                Using sql As New SqlProcedure("spInsertAttendanceDetail")
                    sql.AddParameter("@ConstituentIdNo", constituentIdNo)
                    sql.AddParameter("@AttendanceID", attendanceID)
                    sql.ExecuteNonQuery()
                End Using
            Next


The script inserts record based on how many record I selected in my data view grid which is in multiple selection mode. But for some reason I need to do the scrip in inserting record in sql server. Thanks!

What I have tried:

I tried this code:
SQL
INSERT INTO tblAttendanceDetail (AttendanceID,ConstituentIdNo)
       Select @AttendanceID,@ConstituentIdNo where @AttendanceID=Arguments.SelectedValues and @ConstituentIdNo=Arguments.SelectedValues


but it throws an error.
Posted
Updated 15-Feb-16 6:53am
v2
Comments
F-ES Sitecore 15-Feb-16 10:49am    
What is the error?
Maciej Los 15-Feb-16 12:54pm    
Why?

1 solution

Your VB script is simply calling a stored procedure, spInsertAttendanceDetail. So, if you only want it in SQL then look at that stored procedure and it has exactly what you need.
 
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