Last post Aug 20, 2015 08:45 AM by Bulldog248
Aug 11, 2015 08:23 AM|Bulldog248|LINK
I'm using Visual Web Developer 2010 Express with SQL Server 2008 Express, VB.
I would like to know if it is possible to issue a command that would cause an updatepanel to update after a SQL Insert command has been executed. If so, how can this be accomplished. Can someone provide an example of how to do this?
Aug 11, 2015 08:53 AM|DeadTroll|LINK
Need a little more description here. Where is the SQL being run from? Stored Proc on the database server? From code on the code behind on the page?
Aug 11, 2015 09:04 AM|Bulldog248|LINK
A snippet of my VB code is below:
querystring = "SELECT * FROM [TMPPRTS] ORDER BY [TMPPRTNO]" '4
R = 0
command = New SqlCommand(querystring, sqlConnection)
reader = command.ExecuteReader()
Prt1 = reader(0).ToString
Prt2 = reader(1).ToString
Prt3 = reader(2).ToString
Prt4 = reader(3).ToString
X = X + 4
R = R + 1
Z = 0
For X = 1 To R Step 1
querystring = "INSERT INTO [TMPPRTS] ([TMPPRTNO], [RELPRTNO], [USERNAME], [CREATETIME]) VALUES("
For Y = 0 To 3 Step 1
querystring = querystring & "'" & idList(Z) & "'"
If Y <> 3 Then querystring = querystring & ", "
If Y = 3 Then querystring = querystring & ")"
Z = Z + 1
Using conn As New OleDbConnection(ConnString)
Using cmd1 As New OleDbCommand(querystring, conn)
cmd1.CommandType = CommandType.Text
TextBox13.Text = X
<asp:UpdatePanel ID="UpdatePanel13" runat="server">
<asp:Label ID="Label13" runat="server" Text="TMPPRTS" Width="200px"></asp:Label>
<asp:TextBox ID="TextBox13" runat="server"></asp:TextBox>
Somewhere in the above loop I would like TextBox13 to show the updated value of the number of Inserts. The full program has several tables transferred to Access and for some reason the textboxes don't update until after all table Inserts have been completed.
This has resulted in the user not knowing if anything is actually happening or not.
Aug 13, 2015 12:16 PM|DeadTroll|LINK
You might be able to do something with an ajax call and some aynch programming.
But I know of no straight forward way to do what you are wanting.
I however would just resolve this with a loading indicator from your update panel
check this link to see how you might implement it.
Aug 18, 2015 11:19 AM|Bulldog248|LINK
I've looked over the link and tried a few things but haven't figured it out yet. For a newbie this is some of the most confusing stuff I've come across so far!
Does anyone else have any suggestions?
Aug 20, 2015 08:45 AM|Bulldog248|LINK
Refer to AJAX solution for "Need help with updatepanel"