如何从SQL Server中的同一表中获取单独的标识值. [英] how to get seperate identity value from same table in sql server.

查看:101
本文介绍了如何从SQL Server中的同一表中获取单独的标识值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表中有两列名为foscode和formno的标识值不同..我有两个文本框,想在两个文本框中的Web表单页面加载时设置标识值..
foscode的起始值为000_11101
formno的起始值为551.
现在我想在名为txtfoscode,txtformno ..的不同文本框中设置不同的ident foscode值和formno值. 所以请帮我做什么...
在此先感谢

I have two columns named foscode and formno in table with different identity values..I have two textbox and want to set ident value on page load of web form in both text box..
foscode starts value is 000_11101
formno starts value is 551.
now I want to set different ident foscode value and formno value in differnt text boxes named txtfoscode, txtformno..
So plz help me what to do for that...
thanks in advance

推荐答案

到目前为止,我没有足够的信息,这是我目前可以提供的帮助
将此片段用作指导


I dont have enough info so far this is what i can help for now
use this snippets as your guide


public void page_Load()
{
 this.LoadYourData();
 var firstColumn=GridView1.SelectedRow.Cells[0].Text;//for foscode
 var secondColumn=GridView1.SelectedRow.Cells[1].Text;//for formno
if(!Page.IsPostBack)
  {
    if(firstColumn.StartWith("000"))
    {
      textfoscode.Text=firstColumn;
    }
   if(secondColumn.StartWith("551"))
    {
      texformno.Text=secondColumn;
    }
  }

}

public void LoadYourData()
{
 //set your connectionstring
 //bind your data into your grid view I guess
}


这篇关于如何从SQL Server中的同一表中获取单独的标识值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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