I am getting Runtime error on line 50. Please Help.
Thank You
Bill
1 <%@ Page Language="VB" %>
2 <%@ import Namespace="Syst em.Data" %>
3 <%@ import Namespace="Syst em.Data.SqlClie nt" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin)
9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new
SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported")
14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1)
15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1)
16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE
status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1)
17 Dim DS1 As DataSet = new DataSet()
18 Comm1.Fill(DS1)
19 DG1.DataSource = DS1
20 DG1.DataBind()
21
22 'Fill the RowCount Integer
23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count
24
25 'Use the ToString() method to bind the row count to the Text
property of the label control.
26 'The Text property expects a string hence the ToString() method
is used.
27 countLabel.Text = RowCount.ToStri ng()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).R ows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder(" ")
33 sb.Append("SELE CT insured.policy, insured.u_key,
insured.effecti ve, insured.expirat ion, ")
34 sb.Append("insu red.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHER E insured.u_key = @u_key ")
37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve,
insured.expirat ion")
38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy, insured.u_key,
insured.effecti ve, insured.expirat ion, " & _
40 "insured.status , insured.audit " & _
41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _
43 "ORDER BY insured.u_key,
insured.effecti ve, insured.expirat ion"
44
45 'Comm2 = new SqlDataAdapter( QS1, Conn1)
46 Dim Comm2 AS SqlDataAdapter
47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1)
48 Comm2.SelectCom mand.Parameters .Add("@u_key",
DS1.Tables(0).R ows(i).item(0). value)
49 Dim DS2 As DataSet = new DataSet()
50 Comm2.Fill(DS2)
51 countLabel.Text = cmdCore
52 I = I + 1
53 Loop
54
55 Dim rightNowEnd as DateTime = DateTime.Now
56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd)
57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd)
58 End Sub
59
60 </script>
61 <html>
62 <head>
63 <title>Insure d with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegi n" width="100%"
runat="Server"> </asp:Label>
68 <asp:Label id="lblTimeBegi n" width="100%"
runat="Server"> </asp:Label>
69 <asp:Label id="countLabel " width="100%"
runat="Server"> </asp:Label>
70 <asp:Label id="lblDateEnd " width="100%"
runat="Server"> </asp:Label>
71 <asp:Label id="lblTimeEnd " width="100%"
runat="Server"> </asp:Label>
72 </body>
73 </html> 6 2393
On line 46 you have:
Dim Comm2 AS SqlDataAdapter
e.g you don't instantiate the SqlDataAdapter at all (should be: Dim Comm2
AS New SqlDataAdapter ) . You do instantiate it on previous line 45, but
that is commented (you seem to use SqlCommand instead and set parameters etc
via it). Just instantiate the SqlDataAdapter and it should work.
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsider
ASP.NET Forum Moderator, AspAlliance Columnist http://blogs.aspadvice.com/joteke
"Bill Patel" <bp****@golde n-isles.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. I am getting Runtime error on line 50. Please Help.
Thank You Bill
1 <%@ Page Language="VB" %> 2 <%@ import Namespace="Syst em.Data" %> 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> 4 <script runat="server"> 5 6 Sub Page_load(Src AS Object, e AS EventArgs) 7 Dim rightNowBegin as DateTime = DateTime.Now 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) 10 11 Dim Conn1 AS SqlConnection 12 Dim Comm1 AS SqlDataAdapter 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) 17 Dim DS1 As DataSet = new DataSet() 18 Comm1.Fill(DS1) 19 DG1.DataSource = DS1 20 DG1.DataBind() 21 22 'Fill the RowCount Integer 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count 24 25 'Use the ToString() method to bind the row count to the Text property of the label control. 26 'The Text property expects a string hence the ToString()
method is used. 27 countLabel.Text = RowCount.ToStri ng() 28 29 Dim I AS Integer = 0 30 DO While I <= DS1.Tables(0).R ows.Count - 1 31 Dim cmdCore As String = "" 32 Dim sb As StringBuilder = New StringBuilder(" ") 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") 34 sb.Append("insu red.status, insured.audit ") 35 sb.Append("FROM insured ") 36 sb.Append("WHER E insured.u_key = @u_key ") 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, insured.expirat ion") 38 cmdCore = sb.ToString() 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, " & _ 40 "insured.status , insured.audit " & _ 41 "FROM insured " & _ 42 "WHERE insured.u_key = @u_key " & _ 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" 44 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) 46 Dim Comm2 AS SqlDataAdapter 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1) 48 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) 49 Dim DS2 As DataSet = new DataSet() 50 Comm2.Fill(DS2) 51 countLabel.Text = cmdCore 52 I = I + 1 53 Loop 54 55 Dim rightNowEnd as DateTime = DateTime.Now 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) 58 End Sub 59 60 </script> 61 <html> 62 <head> 63 <title>Insure d with Losses</title> 64 </head> 65 <body> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> 72 </body> 73 </html>
Teemu, thanks for replying. I am new programmer to asp.net. Still receive
the Runtime Error. I have change code from line 45 to 48. Please make
suggestion in what i programming wrong. 1 <%@ Page Language="VB" %> 2 <%@ import Namespace="Syst em.Data" %> 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> 4 <script runat="server"> 5 6 Sub Page_load(Src AS Object, e AS EventArgs) 7 Dim rightNowBegin as DateTime = DateTime.Now 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) 10 11 Dim Conn1 AS SqlConnection 12 Dim Comm1 AS SqlDataAdapter 13 Conn1 = new
SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE
status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) 17 Dim DS1 As DataSet = new DataSet() 18 Comm1.Fill(DS1) 19 DG1.DataSource = DS1 20 DG1.DataBind() 21 22 'Fill the RowCount Integer 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count 24 25 'Use the ToString() method to bind the row count to the Text
property of the label control. 26 'The Text property expects a string hence the ToString()
method is used. 27 countLabel.Text = RowCount.ToStri ng() 28 29 Dim I AS Integer = 0 30 DO While I <= DS1.Tables(0).R ows.Count - 1 31 Dim cmdCore As String = "" 32 Dim sb As StringBuilder = New StringBuilder(" ") 33 sb.Append("SELE CT insured.policy, insured.u_key,
insured.effecti ve, insured.expirat ion, ") 34 sb.Append("insu red.status, insured.audit ") 35 sb.Append("FROM insured ") 36 sb.Append("WHER E insured.u_key = @u_key ") 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve,
insured.expirat ion") 38 cmdCore = sb.ToString() 39 Dim QS1 As String = "SELECT insured.policy,
insured.u_key, insured.effecti ve, insured.expirat ion, " & _ 40 "insured.status , insured.audit " & _ 41 "FROM insured " & _ 42 "WHERE insured.u_key = @u_key " & _ 43 "ORDER BY insured.u_key,
insured.effecti ve, insured.expirat ion" 44 45 Dim Comm2 AS SqlDataAdapter 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) 47 Comm2.SelectCom mand.Parameters .Add("@u_key",
DS1.Tables(0).R ows(i).item(0). value) 48 Dim cb As SqlCommandBuild er = New
SqlCommandBuild er(Comm2) 49 Dim DS2 As DataSet = new DataSet() 50 Comm2.Fill(DS2) 51 countLabel.Text = cmdCore 52 I = I + 1 53 Loop 54 55 Dim rightNowEnd as DateTime = DateTime.Now 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) 58 End Sub 59 60 </script> 61 <html> 62 <head> 63 <title>Insure d with Losses</title> 64 </head> 65 <body> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> 67 <asp:Label id="lblDateBegi n" width="100%"
runat="Server"> </asp:Label> 68 <asp:Label id="lblTimeBegi n" width="100%"
runat="Server"> </asp:Label> 69 <asp:Label id="countLabel " width="100%"
runat="Server"> </asp:Label> 70 <asp:Label id="lblDateEnd " width="100%"
runat="Server"> </asp:Label> 71 <asp:Label id="lblTimeEnd " width="100%"
runat="Server"> </asp:Label> 72 </body> 73 </html>
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:uN******** ********@TK2MSF TNGP10.phx.gbl. .. On line 46 you have:
Dim Comm2 AS SqlDataAdapter
e.g you don't instantiate the SqlDataAdapter at all (should be: Dim Comm2 AS New SqlDataAdapter ) . You do instantiate it on previous line 45, but that is commented (you seem to use SqlCommand instead and set parameters
etc via it). Just instantiate the SqlDataAdapter and it should work.
-- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsider ASP.NET Forum Moderator, AspAlliance Columnist http://blogs.aspadvice.com/joteke
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. I am getting Runtime error on line 50. Please Help.
Thank You Bill
1 <%@ Page Language="VB" %> 2 <%@ import Namespace="Syst em.Data" %> 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> 4 <script runat="server"> 5 6 Sub Page_load(Src AS Object, e AS EventArgs) 7 Dim rightNowBegin as DateTime = DateTime.Now 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) 10 11 Dim Conn1 AS SqlConnection 12 Dim Comm1 AS SqlDataAdapter 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) 17 Dim DS1 As DataSet = new DataSet() 18 Comm1.Fill(DS1) 19 DG1.DataSource = DS1 20 DG1.DataBind() 21 22 'Fill the RowCount Integer 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count 24 25 'Use the ToString() method to bind the row count to the Text property of the label control. 26 'The Text property expects a string hence the ToString() method is used. 27 countLabel.Text = RowCount.ToStri ng() 28 29 Dim I AS Integer = 0 30 DO While I <= DS1.Tables(0).R ows.Count - 1 31 Dim cmdCore As String = "" 32 Dim sb As StringBuilder = New StringBuilder(" ") 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") 34 sb.Append("insu red.status, insured.audit ") 35 sb.Append("FROM insured ") 36 sb.Append("WHER E insured.u_key = @u_key ") 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, insured.expirat ion") 38 cmdCore = sb.ToString() 39 Dim QS1 As String = "SELECT insured.policy,
insured.u_key, insured.effecti ve, insured.expirat ion, " & _ 40 "insured.status , insured.audit " & _ 41 "FROM insured " & _ 42 "WHERE insured.u_key = @u_key " & _ 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" 44 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) 46 Dim Comm2 AS SqlDataAdapter 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1) 48 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) 49 Dim DS2 As DataSet = new DataSet() 50 Comm2.Fill(DS2) 51 countLabel.Text = cmdCore 52 I = I + 1 53 Loop 54 55 Dim rightNowEnd as DateTime = DateTime.Now 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) 58 End Sub 59 60 </script> 61 <html> 62 <head> 63 <title>Insure d with Losses</title> 64 </head> 65 <body> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> 72 </body> 73 </html>
What do you mean "change code from line 45 to 48"
You still have
45 Dim Comm2 AS SqlDataAdapter 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1)
Line 45 should be
Dim Comm2 as New SQLDataAdapter
"Bill Patel" <bp****@golde n-isles.com> wrote in message
news:#m******** ******@TK2MSFTN GP15.phx.gbl... Teemu, thanks for replying. I am new programmer to asp.net. Still receive the Runtime Error. I have change code from line 45 to 48. Please make suggestion in what i programming wrong.
1 <%@ Page Language="VB" %> 2 <%@ import Namespace="Syst em.Data" %> 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> 4 <script runat="server"> 5 6 Sub Page_load(Src AS Object, e AS EventArgs) 7 Dim rightNowBegin as DateTime = DateTime.Now 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) 10 11 Dim Conn1 AS SqlConnection 12 Dim Comm1 AS SqlDataAdapter 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured
WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) 17 Dim DS1 As DataSet = new DataSet() 18 Comm1.Fill(DS1) 19 DG1.DataSource = DS1 20 DG1.DataBind() 21 22 'Fill the RowCount Integer 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count 24 25 'Use the ToString() method to bind the row count to the
Text property of the label control. 26 'The Text property expects a string hence the ToString() method is used. 27 countLabel.Text = RowCount.ToStri ng() 28 29 Dim I AS Integer = 0 30 DO While I <= DS1.Tables(0).R ows.Count - 1 31 Dim cmdCore As String = "" 32 Dim sb As StringBuilder = New StringBuilder(" ") 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") 34 sb.Append("insu red.status, insured.audit ") 35 sb.Append("FROM insured ") 36 sb.Append("WHER E insured.u_key = @u_key ") 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, insured.expirat ion") 38 cmdCore = sb.ToString() 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, " & _ 40 "insured.status , insured.audit " &
_ 41 "FROM insured " & _ 42 "WHERE insured.u_key = @u_key " &
_ 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" 44 45 Dim Comm2 AS SqlDataAdapter 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) 47 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) 48 Dim cb As SqlCommandBuild er = New SqlCommandBuild er(Comm2) 49 Dim DS2 As DataSet = new DataSet() 50 Comm2.Fill(DS2) 51 countLabel.Text = cmdCore 52 I = I + 1 53 Loop 54 55 Dim rightNowEnd as DateTime = DateTime.Now 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) 58 End Sub 59 60 </script> 61 <html> 62 <head> 63 <title>Insure d with Losses</title> 64 </head> 65 <body> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> 72 </body> 73 </html> "Teemu Keiski" <jo****@aspalli ance.com> wrote in message news:uN******** ********@TK2MSF TNGP10.phx.gbl. .. On line 46 you have:
Dim Comm2 AS SqlDataAdapter
e.g you don't instantiate the SqlDataAdapter at all (should be: Dim
Comm2 AS New SqlDataAdapter ) . You do instantiate it on previous line 45, but that is commented (you seem to use SqlCommand instead and set parameters etc via it). Just instantiate the SqlDataAdapter and it should work.
-- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsider ASP.NET Forum Moderator, AspAlliance Columnist http://blogs.aspadvice.com/joteke
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. I am getting Runtime error on line 50. Please Help.
Thank You Bill
1 <%@ Page Language="VB" %> 2 <%@ import Namespace="Syst em.Data" %> 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> 4 <script runat="server"> 5 6 Sub Page_load(Src AS Object, e AS EventArgs) 7 Dim rightNowBegin as DateTime = DateTime.Now 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) 10 11 Dim Conn1 AS SqlConnection 12 Dim Comm1 AS SqlDataAdapter 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured
WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) 17 Dim DS1 As DataSet = new DataSet() 18 Comm1.Fill(DS1) 19 DG1.DataSource = DS1 20 DG1.DataBind() 21 22 'Fill the RowCount Integer 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count 24 25 'Use the ToString() method to bind the row count to the
Text property of the label control. 26 'The Text property expects a string hence the ToString() method is used. 27 countLabel.Text = RowCount.ToStri ng() 28 29 Dim I AS Integer = 0 30 DO While I <= DS1.Tables(0).R ows.Count - 1 31 Dim cmdCore As String = "" 32 Dim sb As StringBuilder = New StringBuilder(" ") 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") 34 sb.Append("insu red.status, insured.audit ") 35 sb.Append("FROM insured ") 36 sb.Append("WHER E insured.u_key = @u_key ") 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, insured.expirat ion") 38 cmdCore = sb.ToString() 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, " & _ 40 "insured.status , insured.audit " &
_ 41 "FROM insured " & _ 42 "WHERE insured.u_key = @u_key " &
_ 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" 44 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) 46 Dim Comm2 AS SqlDataAdapter 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1) 48 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) 49 Dim DS2 As DataSet = new DataSet() 50 Comm2.Fill(DS2) 51 countLabel.Text = cmdCore 52 I = I + 1 53 Loop 54 55 Dim rightNowEnd as DateTime = DateTime.Now 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) 58 End Sub 59 60 </script> 61 <html> 62 <head> 63 <title>Insure d with Losses</title> 64 </head> 65 <body> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> 72 </body> 73 </html>
I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error still
shows.
"Jeff Dillon" <je**@removeeme rgencyreporting .com> wrote in message
news:O1******** ******@TK2MSFTN GP14.phx.gbl... What do you mean "change code from line 45 to 48"
You still have
45 Dim Comm2 AS SqlDataAdapter > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) Line 45 should be
Dim Comm2 as New SQLDataAdapter
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:#m******** ******@TK2MSFTN GP15.phx.gbl... Teemu, thanks for replying. I am new programmer to asp.net. Still
receive the Runtime Error. I have change code from line 45 to 48. Please make suggestion in what i programming wrong.
> 1 <%@ Page Language="VB" %> > 2 <%@ import Namespace="Syst em.Data" %> > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > 4 <script runat="server"> > 5 > 6 Sub Page_load(Src AS Object, e AS EventArgs) > 7 Dim rightNowBegin as DateTime = DateTime.Now > 8 lblDateBegin.Te xt = String.Format(" {0:d}",
rightNowBegin) > 9 lblTimeBegin.Te xt = String.Format(" {0:T}",
rightNowBegin) > 10 > 11 Dim Conn1 AS SqlConnection > 12 Dim Comm1 AS SqlDataAdapter > 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > 17 Dim DS1 As DataSet = new DataSet() > 18 Comm1.Fill(DS1) > 19 DG1.DataSource = DS1 > 20 DG1.DataBind() > 21 > 22 'Fill the RowCount Integer > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > 24 > 25 'Use the ToString() method to bind the row count to the Text property of the label control. > 26 'The Text property expects a string hence the ToString() method is used. > 27 countLabel.Text = RowCount.ToStri ng() > 28 > 29 Dim I AS Integer = 0 > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > 31 Dim cmdCore As String = "" > 32 Dim sb As StringBuilder = New StringBuilder(" ") > 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") > 34 sb.Append("insu red.status, insured.audit ") > 35 sb.Append("FROM insured ") > 36 sb.Append("WHER E insured.u_key = @u_key ") > 37 sb.Append("ORDE R BY insured.u_key,
insured.effecti ve, insured.expirat ion") > 38 cmdCore = sb.ToString() > 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, " & _ > 40 "insured.status , insured.audit "
& _ > 41 "FROM insured " & _ > 42 "WHERE insured.u_key = @u_key "
& _ > 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" > 44 > 45 Dim Comm2 AS SqlDataAdapter > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) > 47 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) > 48 Dim cb As SqlCommandBuild er = New SqlCommandBuild er(Comm2) > 49 Dim DS2 As DataSet = new DataSet() > 50 Comm2.Fill(DS2) > 51 countLabel.Text = cmdCore > 52 I = I + 1 > 53 Loop > 54 > 55 Dim rightNowEnd as DateTime = DateTime.Now > 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) > 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) > 58 End Sub > 59 > 60 </script> > 61 <html> > 62 <head> > 63 <title>Insure d with Losses</title> > 64 </head> > 65 <body> > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> > 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> > 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> > 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> > 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> > 72 </body> > 73 </html>
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message news:uN******** ********@TK2MSF TNGP10.phx.gbl. .. On line 46 you have:
Dim Comm2 AS SqlDataAdapter
e.g you don't instantiate the SqlDataAdapter at all (should be: Dim Comm2 AS New SqlDataAdapter ) . You do instantiate it on previous line 45,
but that is commented (you seem to use SqlCommand instead and set
parameters etc via it). Just instantiate the SqlDataAdapter and it should work.
-- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsider ASP.NET Forum Moderator, AspAlliance Columnist http://blogs.aspadvice.com/joteke
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. > I am getting Runtime error on line 50. Please Help. > > Thank You > Bill > > 1 <%@ Page Language="VB" %> > 2 <%@ import Namespace="Syst em.Data" %> > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > 4 <script runat="server"> > 5 > 6 Sub Page_load(Src AS Object, e AS EventArgs) > 7 Dim rightNowBegin as DateTime = DateTime.Now > 8 lblDateBegin.Te xt = String.Format(" {0:d}",
rightNowBegin) > 9 lblTimeBegin.Te xt = String.Format(" {0:T}",
rightNowBegin) > 10 > 11 Dim Conn1 AS SqlConnection > 12 Dim Comm1 AS SqlDataAdapter > 13 Conn1 = new >
SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE > status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > 17 Dim DS1 As DataSet = new DataSet() > 18 Comm1.Fill(DS1) > 19 DG1.DataSource = DS1 > 20 DG1.DataBind() > 21 > 22 'Fill the RowCount Integer > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > 24 > 25 'Use the ToString() method to bind the row count to the Text > property of the label control. > 26 'The Text property expects a string hence the ToString() method > is used. > 27 countLabel.Text = RowCount.ToStri ng() > 28 > 29 Dim I AS Integer = 0 > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > 31 Dim cmdCore As String = "" > 32 Dim sb As StringBuilder = New StringBuilder(" ") > 33 sb.Append("SELE CT insured.policy, insured.u_key, > insured.effecti ve, insured.expirat ion, ") > 34 sb.Append("insu red.status, insured.audit ") > 35 sb.Append("FROM insured ") > 36 sb.Append("WHER E insured.u_key = @u_key ") > 37 sb.Append("ORDE R BY insured.u_key,
insured.effecti ve, > insured.expirat ion") > 38 cmdCore = sb.ToString() > 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, > insured.effecti ve, insured.expirat ion, " & _ > 40 "insured.status , insured.audit "
& _ > 41 "FROM insured " & _ > 42 "WHERE insured.u_key = @u_key "
& _ > 43 "ORDER BY insured.u_key, > insured.effecti ve, insured.expirat ion" > 44 > 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) > 46 Dim Comm2 AS SqlDataAdapter > 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1) > 48 Comm2.SelectCom mand.Parameters .Add("@u_key", > DS1.Tables(0).R ows(i).item(0). value) > 49 Dim DS2 As DataSet = new DataSet() > 50 Comm2.Fill(DS2) > 51 countLabel.Text = cmdCore > 52 I = I + 1 > 53 Loop > 54 > 55 Dim rightNowEnd as DateTime = DateTime.Now > 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) > 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) > 58 End Sub > 59 > 60 </script> > 61 <html> > 62 <head> > 63 <title>Insure d with Losses</title> > 64 </head> > 65 <body> > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > 67 <asp:Label id="lblDateBegi n" width="100%" > runat="Server"> </asp:Label> > 68 <asp:Label id="lblTimeBegi n" width="100%" > runat="Server"> </asp:Label> > 69 <asp:Label id="countLabel " width="100%" > runat="Server"> </asp:Label> > 70 <asp:Label id="lblDateEnd " width="100%" > runat="Server"> </asp:Label> > 71 <asp:Label id="lblTimeEnd " width="100%" > runat="Server"> </asp:Label> > 72 </body> > 73 </html> > >
The code you included again didn't show your change..
Jeff
"Bill Patel" <bp****@golde n-isles.com> wrote in message
news:OY******** ******@TK2MSFTN GP10.phx.gbl... I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error
still shows.
"Jeff Dillon" <je**@removeeme rgencyreporting .com> wrote in message news:O1******** ******@TK2MSFTN GP14.phx.gbl... What do you mean "change code from line 45 to 48"
You still have
45 Dim Comm2 AS SqlDataAdapter > > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) Line 45 should be
Dim Comm2 as New SQLDataAdapter
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:#m******** ******@TK2MSFTN GP15.phx.gbl... Teemu, thanks for replying. I am new programmer to asp.net. Still receive the Runtime Error. I have change code from line 45 to 48. Please make suggestion in what i programming wrong.
> > 1 <%@ Page Language="VB" %> > > 2 <%@ import Namespace="Syst em.Data" %> > > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > > 4 <script runat="server"> > > 5 > > 6 Sub Page_load(Src AS Object, e AS EventArgs) > > 7 Dim rightNowBegin as DateTime = DateTime.Now > > 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) > > 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) > > 10 > > 11 Dim Conn1 AS SqlConnection > > 12 Dim Comm1 AS SqlDataAdapter > > 13 Conn1 = new SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) > > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT",
Conn1) > > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > > 17 Dim DS1 As DataSet = new DataSet() > > 18 Comm1.Fill(DS1) > > 19 DG1.DataSource = DS1 > > 20 DG1.DataBind() > > 21 > > 22 'Fill the RowCount Integer > > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > > 24 > > 25 'Use the ToString() method to bind the row count to
the Text property of the label control. > > 26 'The Text property expects a string hence the
ToString() method is used. > > 27 countLabel.Text = RowCount.ToStri ng() > > 28 > > 29 Dim I AS Integer = 0 > > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > > 31 Dim cmdCore As String = "" > > 32 Dim sb As StringBuilder = New StringBuilder(" ") > > 33 sb.Append("SELE CT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, ") > > 34 sb.Append("insu red.status, insured.audit ") > > 35 sb.Append("FROM insured ") > > 36 sb.Append("WHER E insured.u_key = @u_key ") > > 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, insured.expirat ion") > > 38 cmdCore = sb.ToString() > > 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effecti ve, insured.expirat ion, " & _ > > 40 "insured.status , insured.audit
" & _ > > 41 "FROM insured " & _ > > 42 "WHERE insured.u_key = @u_key
" & _ > > 43 "ORDER BY insured.u_key, insured.effecti ve, insured.expirat ion" > > 44 > > 45 Dim Comm2 AS SqlDataAdapter > > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) > > 47 Comm2.SelectCom mand.Parameters .Add("@u_key", DS1.Tables(0).R ows(i).item(0). value) > > 48 Dim cb As SqlCommandBuild er = New SqlCommandBuild er(Comm2) > > 49 Dim DS2 As DataSet = new DataSet() > > 50 Comm2.Fill(DS2) > > 51 countLabel.Text = cmdCore > > 52 I = I + 1 > > 53 Loop > > 54 > > 55 Dim rightNowEnd as DateTime = DateTime.Now > > 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) > > 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) > > 58 End Sub > > 59 > > 60 </script> > > 61 <html> > > 62 <head> > > 63 <title>Insure d with Losses</title> > > 64 </head> > > 65 <body> > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > > 67 <asp:Label id="lblDateBegi n" width="100%" runat="Server"> </asp:Label> > > 68 <asp:Label id="lblTimeBegi n" width="100%" runat="Server"> </asp:Label> > > 69 <asp:Label id="countLabel " width="100%" runat="Server"> </asp:Label> > > 70 <asp:Label id="lblDateEnd " width="100%" runat="Server"> </asp:Label> > > 71 <asp:Label id="lblTimeEnd " width="100%" runat="Server"> </asp:Label> > > 72 </body> > > 73 </html>
"Teemu Keiski" <jo****@aspalli ance.com> wrote in message news:uN******** ********@TK2MSF TNGP10.phx.gbl. .. > On line 46 you have: > > Dim Comm2 AS SqlDataAdapter > > e.g you don't instantiate the SqlDataAdapter at all (should be: Dim Comm2 > AS New SqlDataAdapter ) . You do instantiate it on previous line 45, but > that is commented (you seem to use SqlCommand instead and set parameters etc > via it). Just instantiate the SqlDataAdapter and it should work. > > -- > Teemu Keiski > MCP, Microsoft MVP (ASP.NET), AspInsider > ASP.NET Forum Moderator, AspAlliance Columnist > http://blogs.aspadvice.com/joteke > > > "Bill Patel" <bp****@golde n-isles.com> wrote in message > news:%2******** ********@tk2msf tngp13.phx.gbl. .. > > I am getting Runtime error on line 50. Please Help. > > > > Thank You > > Bill > > > > 1 <%@ Page Language="VB" %> > > 2 <%@ import Namespace="Syst em.Data" %> > > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > > 4 <script runat="server"> > > 5 > > 6 Sub Page_load(Src AS Object, e AS EventArgs) > > 7 Dim rightNowBegin as DateTime = DateTime.Now > > 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) > > 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) > > 10 > > 11 Dim Conn1 AS SqlConnection > > 12 Dim Comm1 AS SqlDataAdapter > > 13 Conn1 = new > > SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT", Conn1) > > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT",
Conn1) > > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM Insured WHERE > > status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > > 17 Dim DS1 As DataSet = new DataSet() > > 18 Comm1.Fill(DS1) > > 19 DG1.DataSource = DS1 > > 20 DG1.DataBind() > > 21 > > 22 'Fill the RowCount Integer > > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > > 24 > > 25 'Use the ToString() method to bind the row count to
the Text > > property of the label control. > > 26 'The Text property expects a string hence the
ToString() > method > > is used. > > 27 countLabel.Text = RowCount.ToStri ng() > > 28 > > 29 Dim I AS Integer = 0 > > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > > 31 Dim cmdCore As String = "" > > 32 Dim sb As StringBuilder = New StringBuilder(" ") > > 33 sb.Append("SELE CT insured.policy, insured.u_key, > > insured.effecti ve, insured.expirat ion, ") > > 34 sb.Append("insu red.status, insured.audit ") > > 35 sb.Append("FROM insured ") > > 36 sb.Append("WHER E insured.u_key = @u_key ") > > 37 sb.Append("ORDE R BY insured.u_key,
insured.effecti ve, > > insured.expirat ion") > > 38 cmdCore = sb.ToString() > > 39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, > > insured.effecti ve, insured.expirat ion, " & _ > > 40 "insured.status , insured.audit
" & _ > > 41 "FROM insured " & _ > > 42 "WHERE insured.u_key = @u_key
" & _ > > 43 "ORDER BY insured.u_key, > > insured.effecti ve, insured.expirat ion" > > 44 > > 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) > > 46 Dim Comm2 AS SqlDataAdapter > > 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore,
Conn1) > > 48 Comm2.SelectCom mand.Parameters .Add("@u_key", > > DS1.Tables(0).R ows(i).item(0). value) > > 49 Dim DS2 As DataSet = new DataSet() > > 50 Comm2.Fill(DS2) > > 51 countLabel.Text = cmdCore > > 52 I = I + 1 > > 53 Loop > > 54 > > 55 Dim rightNowEnd as DateTime = DateTime.Now > > 56 lblDateEnd.Text = String.Format(" {0:d}", rightNowEnd) > > 57 lblTimeEnd.Text = String.Format(" {0:T}", rightNowEnd) > > 58 End Sub > > 59 > > 60 </script> > > 61 <html> > > 62 <head> > > 63 <title>Insure d with Losses</title> > > 64 </head> > > 65 <body> > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > > 67 <asp:Label id="lblDateBegi n" width="100%" > > runat="Server"> </asp:Label> > > 68 <asp:Label id="lblTimeBegi n" width="100%" > > runat="Server"> </asp:Label> > > 69 <asp:Label id="countLabel " width="100%" > > runat="Server"> </asp:Label> > > 70 <asp:Label id="lblDateEnd " width="100%" > > runat="Server"> </asp:Label> > > 71 <asp:Label id="lblTimeEnd " width="100%" > > runat="Server"> </asp:Label> > > 72 </body> > > 73 </html> > > > > > >
I have the code working.
"Jeff Dillon" <je**@removeeme rgencyreporting .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. The code you included again didn't show your change..
Jeff
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:OY******** ******@TK2MSFTN GP10.phx.gbl... I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error still shows.
"Jeff Dillon" <je**@removeeme rgencyreporting .com> wrote in message news:O1******** ******@TK2MSFTN GP14.phx.gbl... What do you mean "change code from line 45 to 48"
You still have
45 Dim Comm2 AS SqlDataAdapter > > > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1)
Line 45 should be
Dim Comm2 as New SQLDataAdapter
"Bill Patel" <bp****@golde n-isles.com> wrote in message news:#m******** ******@TK2MSFTN GP15.phx.gbl... > Teemu, thanks for replying. I am new programmer to asp.net. Still receive > the Runtime Error. I have change code from line 45 to 48. Please
make > suggestion in what i programming wrong. > > > > 1 <%@ Page Language="VB" %> > > > 2 <%@ import Namespace="Syst em.Data" %> > > > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > > > 4 <script runat="server"> > > > 5 > > > 6 Sub Page_load(Src AS Object, e AS EventArgs) > > > 7 Dim rightNowBegin as DateTime = DateTime.Now > > > 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) > > > 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) > > > 10 > > > 11 Dim Conn1 AS SqlConnection > > > 12 Dim Comm1 AS SqlDataAdapter > > > 13 Conn1 = new >
SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > > > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT",
Conn1) > > > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) > > > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM
Insured WHERE > status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > > > 17 Dim DS1 As DataSet = new DataSet() > > > 18 Comm1.Fill(DS1) > > > 19 DG1.DataSource = DS1 > > > 20 DG1.DataBind() > > > 21 > > > 22 'Fill the RowCount Integer > > > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > > > 24 > > > 25 'Use the ToString() method to bind the row count to the Text > property of the label control. > > > 26 'The Text property expects a string hence the ToString() > method is used. > > > 27 countLabel.Text = RowCount.ToStri ng() > > > 28 > > > 29 Dim I AS Integer = 0 > > > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > > > 31 Dim cmdCore As String = "" > > > 32 Dim sb As StringBuilder = New StringBuilder(" ") > > > 33 sb.Append("SELE CT insured.policy, insured.u_key, > insured.effecti ve, insured.expirat ion, ") > > > 34 sb.Append("insu red.status, insured.audit ") > > > 35 sb.Append("FROM insured ") > > > 36 sb.Append("WHER E insured.u_key = @u_key ") > > > 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, > insured.expirat ion") > > > 38 cmdCore = sb.ToString() > > > 39 Dim QS1 As String = "SELECT insured.policy, > insured.u_key, insured.effecti ve, insured.expirat ion, " & _ > > > 40 "insured.status ,
insured.audit " & _ > > > 41 "FROM insured " & _ > > > 42 "WHERE insured.u_key =
@u_key " & _ > > > 43 "ORDER BY insured.u_key, > insured.effecti ve, insured.expirat ion" > > > 44 > > > 45 Dim Comm2 AS SqlDataAdapter > > > 46 Comm2.SelectCom mand = New SqlCommand(QS1, Conn1) > > > 47 Comm2.SelectCom mand.Parameters .Add("@u_key", > DS1.Tables(0).R ows(i).item(0). value) > > > 48 Dim cb As SqlCommandBuild er = New > SqlCommandBuild er(Comm2) > > > 49 Dim DS2 As DataSet = new DataSet() > > > 50 Comm2.Fill(DS2) > > > 51 countLabel.Text = cmdCore > > > 52 I = I + 1 > > > 53 Loop > > > 54 > > > 55 Dim rightNowEnd as DateTime = DateTime.Now > > > 56 lblDateEnd.Text = String.Format(" {0:d}",
rightNowEnd) > > > 57 lblTimeEnd.Text = String.Format(" {0:T}",
rightNowEnd) > > > 58 End Sub > > > 59 > > > 60 </script> > > > 61 <html> > > > 62 <head> > > > 63 <title>Insure d with Losses</title> > > > 64 </head> > > > 65 <body> > > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > > > 67 <asp:Label id="lblDateBegi n" width="100%" > runat="Server"> </asp:Label> > > > 68 <asp:Label id="lblTimeBegi n" width="100%" > runat="Server"> </asp:Label> > > > 69 <asp:Label id="countLabel " width="100%" > runat="Server"> </asp:Label> > > > 70 <asp:Label id="lblDateEnd " width="100%" > runat="Server"> </asp:Label> > > > 71 <asp:Label id="lblTimeEnd " width="100%" > runat="Server"> </asp:Label> > > > 72 </body> > > > 73 </html> > > "Teemu Keiski" <jo****@aspalli ance.com> wrote in message > news:uN******** ********@TK2MSF TNGP10.phx.gbl. .. > > On line 46 you have: > > > > Dim Comm2 AS SqlDataAdapter > > > > e.g you don't instantiate the SqlDataAdapter at all (should be:
Dim Comm2 > > AS New SqlDataAdapter ) . You do instantiate it on previous line
45, but > > that is commented (you seem to use SqlCommand instead and set parameters > etc > > via it). Just instantiate the SqlDataAdapter and it should work. > > > > -- > > Teemu Keiski > > MCP, Microsoft MVP (ASP.NET), AspInsider > > ASP.NET Forum Moderator, AspAlliance Columnist > > http://blogs.aspadvice.com/joteke > > > > > > "Bill Patel" <bp****@golde n-isles.com> wrote in message > > news:%2******** ********@tk2msf tngp13.phx.gbl. .. > > > I am getting Runtime error on line 50. Please Help. > > > > > > Thank You > > > Bill > > > > > > 1 <%@ Page Language="VB" %> > > > 2 <%@ import Namespace="Syst em.Data" %> > > > 3 <%@ import Namespace="Syst em.Data.SqlClie nt" %> > > > 4 <script runat="server"> > > > 5 > > > 6 Sub Page_load(Src AS Object, e AS EventArgs) > > > 7 Dim rightNowBegin as DateTime = DateTime.Now > > > 8 lblDateBegin.Te xt = String.Format(" {0:d}", rightNowBegin) > > > 9 lblTimeBegin.Te xt = String.Format(" {0:T}", rightNowBegin) > > > 10 > > > 11 Dim Conn1 AS SqlConnection > > > 12 Dim Comm1 AS SqlDataAdapter > > > 13 Conn1 = new > > > SqlConnection(" server=thales;u id=sa;pwd=36ove rhaul;database= reported") > > > 14 Comm1 = new SqlDataAdapter( "DELETE ClientLRDT",
Conn1) > > > 15 Comm1 = new SqlDataAdapter( "DELETE ClientLRDFT", Conn1) > > > 16 Comm1 = new SqlDataAdapter( "SELECT u_key FROM
Insured WHERE > > > status = 'IF' GROUP BY u_key ORDER BY u_key", Conn1) > > > 17 Dim DS1 As DataSet = new DataSet() > > > 18 Comm1.Fill(DS1) > > > 19 DG1.DataSource = DS1 > > > 20 DG1.DataBind() > > > 21 > > > 22 'Fill the RowCount Integer > > > 23 Dim RowCount As Integer = DS1.Tables(0).R ows.Count > > > 24 > > > 25 'Use the ToString() method to bind the row count to the Text > > > property of the label control. > > > 26 'The Text property expects a string hence the ToString() > > method > > > is used. > > > 27 countLabel.Text = RowCount.ToStri ng() > > > 28 > > > 29 Dim I AS Integer = 0 > > > 30 DO While I <= DS1.Tables(0).R ows.Count - 1 > > > 31 Dim cmdCore As String = "" > > > 32 Dim sb As StringBuilder = New StringBuilder(" ") > > > 33 sb.Append("SELE CT insured.policy, insured.u_key, > > > insured.effecti ve, insured.expirat ion, ") > > > 34 sb.Append("insu red.status, insured.audit ") > > > 35 sb.Append("FROM insured ") > > > 36 sb.Append("WHER E insured.u_key = @u_key ") > > > 37 sb.Append("ORDE R BY insured.u_key, insured.effecti ve, > > > insured.expirat ion") > > > 38 cmdCore = sb.ToString() > > > 39 Dim QS1 As String = "SELECT insured.policy, > insured.u_key, > > > insured.effecti ve, insured.expirat ion, " & _ > > > 40 "insured.status ,
insured.audit " & _ > > > 41 "FROM insured " & _ > > > 42 "WHERE insured.u_key =
@u_key " & _ > > > 43 "ORDER BY insured.u_key, > > > insured.effecti ve, insured.expirat ion" > > > 44 > > > 45 'Comm2 = new SqlDataAdapter( QS1, Conn1) > > > 46 Dim Comm2 AS SqlDataAdapter > > > 47 Comm2.SelectCom mand = New SqlCommand(cmdC ore, Conn1) > > > 48 Comm2.SelectCom mand.Parameters .Add("@u_key", > > > DS1.Tables(0).R ows(i).item(0). value) > > > 49 Dim DS2 As DataSet = new DataSet() > > > 50 Comm2.Fill(DS2) > > > 51 countLabel.Text = cmdCore > > > 52 I = I + 1 > > > 53 Loop > > > 54 > > > 55 Dim rightNowEnd as DateTime = DateTime.Now > > > 56 lblDateEnd.Text = String.Format(" {0:d}",
rightNowEnd) > > > 57 lblTimeEnd.Text = String.Format(" {0:T}",
rightNowEnd) > > > 58 End Sub > > > 59 > > > 60 </script> > > > 61 <html> > > > 62 <head> > > > 63 <title>Insure d with Losses</title> > > > 64 </head> > > > 65 <body> > > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" /> > > > 67 <asp:Label id="lblDateBegi n" width="100%" > > > runat="Server"> </asp:Label> > > > 68 <asp:Label id="lblTimeBegi n" width="100%" > > > runat="Server"> </asp:Label> > > > 69 <asp:Label id="countLabel " width="100%" > > > runat="Server"> </asp:Label> > > > 70 <asp:Label id="lblDateEnd " width="100%" > > > runat="Server"> </asp:Label> > > > 71 <asp:Label id="lblTimeEnd " width="100%" > > > runat="Server"> </asp:Label> > > > 72 </body> > > > 73 </html> > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bob Bamberg |
last post by:
Hello All,
I have been trying without luck to get some information on debugging
the Runtime Error R6025 - Pure Virtual Function Call. I am working in
C++ and have only one class that is derived from an Abstract class, I
do not believe that this class object is causing me my problem. Below
is that message I have posted before to other groups.
Question:
|
by: Nathan Bloom |
last post by:
Hi,
I have a secured database that runs fine on the computer the database is
installed on. I have several workstations with access runtime installed
that also need access to the database. Access runtime runs fine when
accessing an unsecured version of the database. However once the database
was secured it generates a runtime error after asking for the user and
password and won't open. The shortcut to the secured database is:
"path...
|
by: Paul |
last post by:
I'm hoping someone can help me with the problem.
I have a database where the default value for a date field in a table is
=date()
This works perfectly in my table and on my form. But when I complile the
DB into a 97 Runtime, the date field displays and #error? in the runtime.
But if I open the runtime db on a system with Access 97, there is no error.
I have tried the runtime on mulitple systems (that dont have Access
installed) and...
|
by: Markus Ewald |
last post by:
I'm just experimenting around with the VisualC++ 2005 Express Edition Beta
and found some strange behavior for which I can't seem to find a workaround.
What I've done is set up two static library projects for Lua 5.0.2 and
LuaBind beta-6, compiling both with no CLR support and configured to use the
Multithreaded DLL runtime. Then I created a new console application which
makes use of these two static libraries (of course, also set to MT...
|
by: Kirk |
last post by:
I'm trying to use a Web Service to be a Remoting client of an existing
..NET 2.0 server. But I get the following error when I try to use
System.Runtime.Remoting.Channels.Http in my WebService. The same code
works fine in a standalone app. I have inspected
System.Runtime.Remoting.dll with ildasm, and I can see the
....Channels.Http namespace there. I verified that the virtual
directory is configured to use v2.0.50727 (the error message...
| |
by: zfraile |
last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss'
machine, not my development machine. I believe the error is generated from a
call to an Excel object, but I can't tell why or what specific action on the
object is causing it.
We both are running version 2.0 of the .net framework with Office 2003
installed, though I am running XP and she has Win2000. Also, I do not get
this error when running another sub in...
|
by: Yelena Varshal via AccessMonster.com |
last post by:
Hello
We have a shortcut for our MS ACCESS application that uses a /Runtime switch
because we may have some users that use Runtime. The application worked fine
in Access 2000 and was tested with 2003 in the spring. Now that we started to
use it with MS ACCESS 2003 (Full version) we are getting the error on the
last form close when exiting the application. We don't have this error if
deleting /Runtime switch from the shortcut.. The error...
|
by: Norman Diamond |
last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet
Framework 2. Options are set in the setup project properties, so if these
two dependencies are not already installed then this installer will install
them.
But what about the situation where VC runtime has already been installed?
In fact it's been installed twice. Although the project was built on a
Windows XP system with Visual Studio 2005 SP1 and the results were...
|
by: Jim Armstrong |
last post by:
Hello all -
This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:
taxID (PK)
ClientName
SalesName
The main form of my application allows a user to select a client and
|
by: BL3WC |
last post by:
Hi,
I'd created a MDE under Access 2003. It is now under testing stage. Some of the users will use Access 2003 runtime and some will use Access 2007 runtime to run this MDE. I installed the Access 2007 runtime on a test machine and place the MDE in the Desktop for user's initial testing. I did not create a trust area for this MDE in the test machine as well as in my development machine.
When I tested the MDE using /runtime switch in my...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |