将数据库中的Autopost置于文本框中 [英] Getting Autopost from database into textbox

查看:108
本文介绍了将数据库中的Autopost置于文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我有一个名为Docket no的id。当它进入Docketno时,该表中对应于该表的详细信息将进入textBox。假设,我必须在5个文本框中输入。在5文本框中,它将再次获取一个id,它将填充2个文本框。这应该没有Button.I已完成此使用按钮

我会很高兴如果这可以使用Java脚本。

谢谢如果有人帮助我使用代码



protected void Page_Load(object sender,EventArgs e)

{

{

String DocketNo = Docket_No.Text;

String Branch = From_STN.Text;

String Date = Date_Time.Text;

SqlConnection conn;

SqlCommand comm;

SqlDataReader reader;

string connnectionString = ConfigurationManager.ConnectionStrings [amitpandeyConnectionString]。ConnectionString;

conn = new SqlConnection(connnectionString);

if(Docket_No.Text ==)// IF符合扫描件ID

{





comm = new SqlCommand(@SELECT Branch,Date,DocketNo Where Branch = @Branch and Date = @ date and DocketNo = @DocketNo,conn);

}

conn.Open();

comm.Parameters.AddWithValue(@ Branch,To_STN.Text);

comm.Parameters.AddWithValue(@ date,Date_Time .Text);

comm.Parameters.AddWithValue(@ DocketNo,Docket_No.Text);

reader = comm.ExecuteReader();



reader.Close();

conn.Close();

}

}

解决方案

请查看更多关于文本框已更改事件的信息。如果它的ASP.Net应用程序确保将自动回发属性设置为true。



http://msdn.microsoft.com/en-IN/library/system.windows.controls.textbox。 textchanged%28v = vs.95%29.aspx [ ^ ]



http://msdn.microsoft.com/en-us/library/ms742880%28v=vs.110%29 .aspx [ ^ ]



http://www.java2s.com/Tutorial/ASP.NET/0060__ASP.net-Controls/aspTextBoxchangedeventC.htm [ ^ ]


Sir, I have an id named Docket no. When it Enter the Docketno the details in that table corresponding to that table comes to the textBox. Suppose , I have To get the entry in 5 text boxes. in the 5 textbox it will again get an id from where it will fill 2 text boxes.This should be done without Button.I have Done this Using Buttons
I will Be happy If this can be done using Java Script.
Thanks If Some One helps me with Code

protected void Page_Load(object sender, EventArgs e)
{
{
String DocketNo = Docket_No.Text;
String Branch= From_STN.Text;
String Date = Date_Time.Text;
SqlConnection conn;
SqlCommand comm;
SqlDataReader reader;
string connnectionString = ConfigurationManager.ConnectionStrings["amitpandeyConnectionString"].ConnectionString;
conn = new SqlConnection(connnectionString);
if (Docket_No.Text == "") // IF match the scan ID
{


comm = new SqlCommand(@"SELECT Branch,Date,DocketNo Where Branch = @Branch and Date =@date and DocketNo = @DocketNo", conn);
}
conn.Open();
comm.Parameters.AddWithValue("@Branch", To_STN.Text);
comm.Parameters.AddWithValue("@date", Date_Time.Text);
comm.Parameters.AddWithValue(" @DocketNo", Docket_No.Text);
reader = comm.ExecuteReader();

reader.Close();
conn.Close();
}
}

解决方案

Please check more on text box changed event. If its an ASP.Net application make sure to set the auto postback attribute to true.

http://msdn.microsoft.com/en-IN/library/system.windows.controls.textbox.textchanged%28v=vs.95%29.aspx[^]

http://msdn.microsoft.com/en-us/library/ms742880%28v=vs.110%29.aspx[^]

http://www.java2s.com/Tutorial/ASP.NET/0060__ASP.net-Controls/aspTextBoxchangedeventC.htm[^]


这篇关于将数据库中的Autopost置于文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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