将数据库中的Autopost置于文本框中 [英] Getting Autopost from database into textbox
问题描述
我会很高兴如果这可以使用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屋!