I'm using Visual Web Developer 2010 Express with SQL Server 2008 Express, VB.
I have a page designed to copy database tables from SQL to Access and for the most part it works fine. The problem is in displaying some kind of "status" or "progress" during the run time.
The page looks something like below; blank areas are TextBoxes displaying the total records transferred, table names are Labels:
Table Records transferred
Capacitors __________
Connectors __________
"
Resistors __________
Transformers __________
There is a total of 14 tables that transfer and the process can take several minutes. I would like some kind of display next to the TextBoxes at least indicating which table is currently transferring and for the TextBoxes to display the totals as each table completes. The code below transfers the data but I haven't yet figured how to display a status or some kind of "In Progress..." indicator.. The TextBoxes all seem to update AFTER the last table has transferred so the user is left wondering if anything is happening.
The entire transfer is initiated by a single Button click.
ASP code snippet:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Capacitors" Width="200px"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Label ID="Label2" runat="server" Text="Connectors" Width="200px"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel9" runat="server">
<ContentTemplate>
<asp:Label ID="Label9" runat="server" Text="Resistors" Width="200px"></asp:Label>
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel12" runat="server">
<ContentTemplate>
<asp:Label ID="Label12" runat="server" Text="Transistors" Width="200px"></asp:Label>
<asp:TextBox ID="TextBox12" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
VB code snippet:
querystring = "SELECT * FROM [Capacitors] ORDER BY [PART_NUMBER]" '38
sqlConnection.Open()
Dim command As New SqlCommand(querystring, sqlConnection)
Dim reader As SqlDataReader = command.ExecuteReader()
While reader.Read()
Prt1 = reader(0).ToString
idList.Add(Prt1.ToString())
Prt2 = reader(1).ToString
idList.Add(Prt2.ToString())
Prt3 = reader(2).ToString
idList.Add(Prt3.ToString())
Prt4 = reader(3).ToString
idList.Add(Prt4.ToString())
Prt5 = reader(4).ToString
idList.Add(Prt5.ToString())
Prt6 = reader(5).ToString
idList.Add(Prt6.ToString())
Prt7 = reader(6).ToString
idList.Add(Prt7.ToString())
Prt8 = reader(7).ToString
idList.Add(Prt8.ToString())
Prt9 = reader(8).ToString
idList.Add(Prt9.ToString())
Prt10 = reader(9).ToString
idList.Add(Prt10.ToString())
Prt11 = reader(10).ToString
idList.Add(Prt11.ToString())
Prt12 = reader(11).ToString
idList.Add(Prt12.ToString())
Prt13 = reader(12).ToString
idList.Add(Prt13.ToString())
Prt14 = reader(13).ToString
idList.Add(Prt14.ToString())
Prt15 = reader(14).ToString
idList.Add(Prt15.ToString())
Prt16 = reader(15).ToString
idList.Add(Prt16.ToString())
Prt17 = reader(16).ToString
idList.Add(Prt17.ToString())
Prt18 = reader(17).ToString
idList.Add(Prt18.ToString())
Prt19 = reader(18).ToString
idList.Add(Prt19.ToString())
Prt20 = reader(19).ToString
idList.Add(Prt20.ToString())
Prt21 = reader(20).ToString
idList.Add(Prt21.ToString())
Prt22 = reader(21).ToString
idList.Add(Prt22.ToString())
Prt23 = reader(22).ToString
idList.Add(Prt23.ToString())
Prt24 = reader(23).ToString
idList.Add(Prt24.ToString())
Prt25 = reader(24).ToString
idList.Add(Prt25.ToString())
Prt26 = reader(25).ToString
idList.Add(Prt26.ToString())
Prt27 = reader(26).ToString
idList.Add(Prt27.ToString())
Prt28 = reader(27).ToString
idList.Add(Prt28.ToString())
Prt29 = reader(28).ToString
idList.Add(Prt29.ToString())
Prt30 = reader(29).ToString
idList.Add(Prt30.ToString())
Prt31 = reader(30).ToString
idList.Add(Prt31.ToString())
Prt32 = reader(31).ToString
idList.Add(Prt32.ToString())
Prt33 = reader(32).ToString
idList.Add(Prt33.ToString())
Prt34 = reader(33).ToString
idList.Add(Prt34.ToString())
Prt35 = reader(34).ToString
idList.Add(Prt35.ToString())
Prt36 = reader(35).ToString
idList.Add(Prt36.ToString())
Prt37 = reader(36).ToString
idList.Add(Prt37.ToString())
Prt38 = reader(37).ToString
idList.Add(Prt38.ToString())
X = X + 38
R = R + 1
End While
sqlConnection.Close()
Z = 0
For X = 1 To R Step 1
querystring = "INSERT INTO [Capacitors] ([PART_NUMBER], [Part Type], [Description], [Value], [PCB Footprint], [Schematic Part], [Number of Pins], [Operating Temperature Maximum], [Operating Temperature Minimum], [Package Size], [Package Height], [Package Type], [Company Part Status], [Dielectric Type], [Equivalent Series Resistance], [Temperature Coefficient], [Tolerance], [Rated Voltage], [Implementation], [Implementation Type], [PSpiceTemplate], [Device Type], [UserField01], [UserField02], [UserField03], [UserField04], [UserField05], [UserField06], [UserField07], [UserField08], [UserField09], [UserField10], [TMP Manufacturer], [TMP Manufacturer PN], [Activeparts ID], [CLASS], [LP Viewer], [RowID]) VALUES("
For Y = 0 To 37 Step 1
querystring = querystring & "'" & idList(Z) & "'"
If Y <> 37 Then querystring = querystring & ", "
If Y = 37 Then querystring = querystring & ")"
Z = Z + 1
Next
Using conn As New OleDbConnection(ConnString)
Using cmd1 As New OleDbCommand(querystring, conn)
cmd1.CommandType = CommandType.Text
conn.Open()
cmd1.ExecuteNonQuery() 'Capacitors
End Using
conn.Close()
End Using
Next
TextBox1.Text = X - 1
Tot = X - 1
idList.Clear()I'm hoping someone can help me with updatepanel or updateprogress so I can get something to display indicating the program is functioning.
Thanks!