本文介绍了根据cookie值在标签中显示值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
进入下面的代码我试图将货币显示为lable称为:CountCurrencLbl取决于国家/地区,这是来自表货币的cookie值我已经完成了代码的第一部分但我做了不知道如何完成它所以请你帮我完成代码并根据国家/地区显示货币。
HttpCookie cookie = Request.Cookies.Get( Location);
if (cookie [ Location] == null )
{
DataTable StateDT = new DataTable ();
使用(SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings [ BeravaConnectionString]。ConnectionString))
{
/ / 创建SelectCommand。
SqlCommand command = new SqlCommand( SELECT货币来自货币WHERE国家= @Location,con2);
var Location = cookie.Value;
command.Parameters.AddWithValue( @ Location,Location);
}
解决方案
Hi
Into below code i am trying to show the currency into lable called: "CountCurrencLbl" depending country which is cookie value from table Currency i have did the first part of the code but i did not know how to complete it so please could you help me to complete the code and show currency depending on country.
HttpCookie cookie = Request.Cookies.Get("Location"); if (cookie["Location"] == null) { DataTable StateDT = new DataTable(); using (SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["BeravaConnectionString"].ConnectionString)) { // Create the SelectCommand. SqlCommand command = new SqlCommand("SELECT Currency FROM Currency WHERE Country = @Location", con2); var Location = cookie.Value; command.Parameters.AddWithValue("@Location", Location); }
解决方案
这篇关于根据cookie值在标签中显示值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!