使用Session传递数据库值并重定向到另一个页面 [英] Passing the database value by using Session and redirect to another page

查看:590
本文介绍了使用Session传递数据库值并重定向到另一个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库如下;



Database as follows;

Bthid  bigint (Datatype in the Database)

  Startexec table (Records as follows)

  Bthid

   718







我从Bthid传递数据库值来自Startexec表使用session并重定向到另一页。



我的代码如下;








I am passing the Bthid the database value from Startexec table using session and redirect to another page.

My code as follows;


SQl = "Select Bthid from startexec";
        BthID = TxtBthNo.Text.ToString().Trim();
        Session["Bthid"] = BthID;
        Response.Redirect("Instruction.aspx");





在数据库中Bthid数据类型是bigint



当我运行Error时如下;



无法将类型''string''隐式转换为''long''



for我怎么能用csharp做什么?



i多次试过但是没用?请帮帮我。''



如何解决?



问候,

Narasiman P



In database Bthid Datatype is bigint

When i run Error as follows;

Cannot implicitly convert type ''string'' to ''long''

for that how can i do using csharp?

i tried several times but it is not working? please help me.''

how can i solve?

Regards,
Narasiman P

推荐答案

尝试更改:



Try changing:

BthID = TxtBthNo.Text.ToString().Trim();











To

BthID = Convert.ToInt64(TxtBthNo.Text.Trim());


这篇关于使用Session传递数据库值并重定向到另一个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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