使用LinqToSQL更新SQL表中的记录 [英] Update record in SQL Table using LinqToSQL

查看:47
本文介绍了使用LinqToSQL更新SQL表中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..
我有一个问题,真的不知道如何解决.
因此,这就是任务,它是关于在网上商店进行订购(用户必须输入信用卡号,安全码和到期日期的最后一部分).
因此,这是用于保存信用卡信息的查询:

Hi there..
I have a problem, and really don`t know how to solve it.
So, this is the task, it`s about making orderds on e-shop (the last part when user have to enter credit card number, security code and date of expiring).
So this is the query for saving credit card info:

using (DataContext dc = new DataContext())
            {
                eCreditCard ek = new eCreditCard();
                var query2 = (from y in dc.eUsers
                             where y.name + " " + y.lname == Session["LoggedUser"].ToString()
                             select y).SingleOrDefault();



                var query3 = (from x in dc.eCreditCards
                             where x.UserFK==query2.id
                             select x).SingleOrDefault();


if(query3==null) // so, if there are no credit card for this logged user, it save all required data!
{
                    ek.CreditCardNumber = txt_cnumber.Text;
                    ek.SecurityCode = txt_code.Text;
                    ek.ExDate = DateTime.Parse(txt_dateEx.Text);
                    ek.UserFK = query2.id;

                    OrdersController.SaveCard(ek);
}
else
{
/*here I have big problem! I want simple thing: if there are credit card for that user, just to update some records (security code, date of expiration..)
I have tried like this:*/
ek.CreditCardNumber = txt_cnumber.Text;
                    ek.SecurityCode = txt_code.Text;
                    ek.ExDate = DateTime.Parse(txt_dateEx.Text);
                    ek.UserFK = query2.id;
dc.SubmitChanges();
//but don`t work. Doesnt change the record.
}



有任何建议吗?



ANY suggesstions?! I would really appreciate it!

推荐答案

好吧,这可能不是您要查找的解决方案,但不存储信用卡信息. PCI规章特别禁止存储以下任何内容:未加密的信用卡号,CVV或CVV2,PIN块,PIN号,磁道1或2.在数据库,日志文件,审计跟踪,备份等中发现的任何上述内容都可能给商家造成严重后果,尤其是在妥协的情况下.基本上,接受接受信用卡即表示您同意遵守PCI.如果您希望能够存储卡信息以用于将来的交易,那么很多付款网关都可以在其末端存储该信息,并且当您要使用该卡进行任何将来的交易时,您只需使用Web服务即可.
Well this is probable not the solution that you are looking for, but do not store credit card information. The PCI regulations specifically forbid storing of any of the following: Unencrypted credit card number, CVV or CVV2, Pin blocks, PIN numbers, Track 1 or 2 data. Any of the above found in databases, log files, audit trails, backup’s etc. can result in serious consequences for the merchant, especially if a compromise has taken place. Basically by accepting to take credit cards you agree to be PCI compliant. If you want to be able you store the card information for future transactions then a lot of payment gateways give you the ability to store that information on their end and you just use a web service when you want to do any future transactions with that card.


这篇关于使用LinqToSQL更新SQL表中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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