如何使用loginid将gridview中的行记录保存到另一个表? [英] How to save row records in gridview using loginid to another table?

查看:128
本文介绍了如何使用loginid将gridview中的行记录保存到另一个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



如何使用用户登录在gridview中保存受尊重的行记录到基于按钮提交的另一个表?如果最终用户尝试单击保存按钮,如果用户未登录,我需要重定向登录页面,如果用户已经登录,我需要保存在另一个表格中。





例如:就像愿望清单保存物品等。 。



提前谢谢。

解决方案

一旦用户点击按钮,你就会谈到2个不同的任务这里调用一个方法来检查用户是否已登录,返回一个布尔值,然后检查此返回是否为true,然后保存数据,否则重定向到登录页面



来自OP的评论后,由同一个人从冗余解决方案2复制的其他信息

如果您的数字是1,请尝试将其保存到变量和转换它串起或使用以下

   insert into savetable(userid,productid,Quantity)值( + Userid.Value.tostring()+   + str +   +  1  .tostring()+  ; 


试试这个





string insert =(插入到savetable(userid,productid,Quantity)值(+ Userid.Value.tostring()+,+ str +',+ 1.tostring()+));

Dear Friends,

How to save respected row records in gridview using user login to another table based on button filed? If end user try to click on save button if the user is not login I need to redirect login page, if the user is already login I need to save in another table.


Ex: Just like wish list or save items etc...

Thanks in advance.

解决方案

you talk about 2 different task once the user click the button here call a method to check for the user is logged in or not which return a Boolean then check for this return if true go on and save the data otherwise redirect to log in page

additional information copied from redundant solution 2 by same person after comment from OP
if you mean by number 1 the quantity , try to save it to variable and the convert it to string or use the following

"insert into savetable(userid,productid,Quantity) values(" + Userid.Value.tostring() + "," + str+ "," + 1.tostring() + ") ";


try this


string insert=("insert into savetable(userid,productid,Quantity) values(" + Userid.Value.tostring() + ",'" + str+ "'," + 1.tostring() + ") ");


这篇关于如何使用loginid将gridview中的行记录保存到另一个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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