如何使用两个表在单个select语句中保存多个gridview值 [英] how to save mutiple gridview values in single select statement using two tables

查看:64
本文介绍了如何使用两个表在单个select语句中保存多个gridview值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gridview中如下



教师gridview如下



FacultyName Question1 Question2 Question3 Question4

Ram Dropdownlist1 Dropdownlist2 Dropdownlist3 Dropdownlist4

Sam Dropdownlist5 Dropdownlist6 Dropdownlist7 Dropdownlist8



教练gridview如下



InstructorName Question1 Question2 Question3 Question4

Ram Dropdownlist1 Dropdownlist2 Dropdownlist3 Dropdownlist4

Sam Dropdownlist5 Dropdownlist6 Dropdownlist7 Dropdownlist8



教师表格strcutre如下



id自动增量

FacName varchar(50)

问题1 int

Question2 int

Question3 int

Question4 int



教练表结构如下

id Autoincrement

InsName varchar(50)

Question1 int

Question2 int

Question3 int

Question4 int





我有一个提交如下。



在该提交按钮中,我想将两个gridview记录保存到Faculty和instructor表中为单个Insert语句。



我怎样才能在asp.net中使用c#。

In gridview as follows

Faculty gridview as follows

FacultyName Question1 Question2 Question3 Question4
Ram Dropdownlist1 Dropdownlist2 Dropdownlist3 Dropdownlist4
Sam Dropdownlist5 Dropdownlist6 Dropdownlist7 Dropdownlist8

Instructor gridview as follows

InstructorName Question1 Question2 Question3 Question4
Ram Dropdownlist1 Dropdownlist2 Dropdownlist3 Dropdownlist4
Sam Dropdownlist5 Dropdownlist6 Dropdownlist7 Dropdownlist8

Faculty Table strcutre as follows

id Autoincrement
FacName varchar(50)
Question1 int
Question2 int
Question3 int
Question4 int

Instructor Table structure as follows
id Autoincrement
InsName varchar(50)
Question1 int
Question2 int
Question3 int
Question4 int


I have one submit as follows.

In that submit button i want to save above two gridview records into Faculty and instructor table into single Insert Statement.

for that how can i do in asp.net using c#.

推荐答案

参考 - 一次性将整个DataTable插入数据库而不是逐行插入? [ ^ ]



此示例发送一个 DataTable 作为插入存储过程的参数。您只需要再发送一个参数并在过程中写入另一个insert语句。
Refer - Insert entire DataTable into database at once instead of row by row?[^]

This example sends one DataTable as a parameter to the Stored Procedure for insertion. You just need to send one more parameter and write another insert statement inside the procedure.


这篇关于如何使用两个表在单个select语句中保存多个gridview值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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