如何将vb.net脚本转换为sql server脚本? [英] How to convert vb.net script to sql server script?

查看:88
本文介绍了如何将vb.net脚本转换为sql server脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net中有这个脚本:



I have this script in vb.net:

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





脚本根据我在数据视图网格中选择的记录数插入记录处于多选模式。但由于某种原因,我需要在sql server中插入记录时执行脚本。谢谢!



我尝试了什么:



我试过这段代码:



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:

INSERT INTO tblAttendanceDetail (AttendanceID,ConstituentIdNo)
       Select @AttendanceID,@ConstituentIdNo where @AttendanceID=Arguments.SelectedValues and @ConstituentIdNo=Arguments.SelectedValues





但它会抛出错误。



but it throws an error.

推荐答案

你的VB脚本只是调用一个存储过程,spInsertAttendanceDetail。因此,如果您只想在SQL中使用它,那么请查看该存储过程,它正是您所需要的。
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.


这篇关于如何将vb.net脚本转换为sql server脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆