473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Runtime Error

I am getting Runtime error on line 50. Please Help.

Thank You
Bill

1 <%@ Page Language="VB" %>
2 <%@ import Namespace="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new
SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, ")
34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective,
insured.expiration")
38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, " & _
40 "insured.status, insured.audit " & _
41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _
43 "ORDER BY insured.u_key,
insured.effective, insured.expiration"
44
45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
46 Dim Comm2 AS SqlDataAdapter
47 Comm2.SelectCommand = New SqlCommand(cmdCore, Conn1)
48 Comm2.SelectCommand.Parameters.Add("@u_key",
DS1.Tables(0).Rows(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%"
runat="Server"></asp:Label>
68 <asp:Label id="lblTimeBegin" 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>
Nov 18 '05 #1
6 2342
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****@golden-isles.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am getting Runtime error on line 50. Please Help.

Thank You
Bill

1 <%@ Page Language="VB" %>
2 <%@ import Namespace="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new
SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, ")
34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective,
insured.expiration")
38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, " & _
40 "insured.status, insured.audit " & _
41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _
43 "ORDER BY insured.u_key,
insured.effective, insured.expiration"
44
45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
46 Dim Comm2 AS SqlDataAdapter
47 Comm2.SelectCommand = New SqlCommand(cmdCore, Conn1)
48 Comm2.SelectCommand.Parameters.Add("@u_key",
DS1.Tables(0).Rows(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%"
runat="Server"></asp:Label>
68 <asp:Label id="lblTimeBegin" 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>

Nov 18 '05 #2
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="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key, insured.effective, insured.expiration, ") 34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective, insured.expiration") 38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effective, insured.expiration, " & _ 40 "insured.status, insured.audit " & _
41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _
43 "ORDER BY insured.u_key, insured.effective, insured.expiration" 44
45 Dim Comm2 AS SqlDataAdapter
46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
47 Comm2.SelectCommand.Parameters.Add("@u_key", DS1.Tables(0).Rows(i).item(0).value) 48 Dim cb As SqlCommandBuilder = New SqlCommandBuilder(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%" runat="Server"></asp:Label> 68 <asp:Label id="lblTimeBegin" 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****@aspalliance.com> wrote in message
news:uN****************@TK2MSFTNGP10.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****@golden-isles.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am getting Runtime error on line 50. Please Help.

Thank You
Bill

1 <%@ Page Language="VB" %>
2 <%@ import Namespace="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new
SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, ")
34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective,
insured.expiration")
38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy,

insured.u_key, insured.effective, insured.expiration, " & _
40 "insured.status, insured.audit " & _
41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _
43 "ORDER BY insured.u_key,
insured.effective, insured.expiration"
44
45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
46 Dim Comm2 AS SqlDataAdapter
47 Comm2.SelectCommand = New SqlCommand(cmdCore, Conn1)
48 Comm2.SelectCommand.Parameters.Add("@u_key",
DS1.Tables(0).Rows(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%"
runat="Server"></asp:Label>
68 <asp:Label id="lblTimeBegin" 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>


Nov 18 '05 #3
What do you mean "change code from line 45 to 48"

You still have

45 Dim Comm2 AS SqlDataAdapter
46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
Line 45 should be

Dim Comm2 as New SQLDataAdapter

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:#m**************@TK2MSFTNGP15.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="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key, insured.effective, insured.expiration, ") 34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective, insured.expiration") 38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy, insured.u_key, insured.effective, insured.expiration, " & _ 40 "insured.status, insured.audit " &
_ 41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _ 43 "ORDER BY insured.u_key, insured.effective, insured.expiration" 44
45 Dim Comm2 AS SqlDataAdapter
46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
47 Comm2.SelectCommand.Parameters.Add("@u_key", DS1.Tables(0).Rows(i).item(0).value) 48 Dim cb As SqlCommandBuilder = New SqlCommandBuilder(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%" runat="Server"></asp:Label> 68 <asp:Label id="lblTimeBegin" 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****@aspalliance.com> wrote in message
news:uN****************@TK2MSFTNGP10.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****@golden-isles.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am getting Runtime error on line 50. Please Help.

Thank You
Bill

1 <%@ Page Language="VB" %>
2 <%@ import Namespace="System.Data" %>
3 <%@ import Namespace="System.Data.SqlClient" %>
4 <script runat="server">
5
6 Sub Page_load(Src AS Object, e AS EventArgs)
7 Dim rightNowBegin as DateTime = DateTime.Now
8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin)
9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin)
10
11 Dim Conn1 AS SqlConnection
12 Dim Comm1 AS SqlDataAdapter
13 Conn1 = new
SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
28
29 Dim I AS Integer = 0
30 DO While I <= DS1.Tables(0).Rows.Count - 1
31 Dim cmdCore As String = ""
32 Dim sb As StringBuilder = New StringBuilder("")
33 sb.Append("SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, ")
34 sb.Append("insured.status, insured.audit ")
35 sb.Append("FROM insured ")
36 sb.Append("WHERE insured.u_key = @u_key ")
37 sb.Append("ORDER BY insured.u_key, insured.effective,
insured.expiration")
38 cmdCore = sb.ToString()
39 Dim QS1 As String = "SELECT insured.policy,

insured.u_key, insured.effective, insured.expiration, " & _
40 "insured.status, insured.audit " & _ 41 "FROM insured " & _
42 "WHERE insured.u_key = @u_key " & _ 43 "ORDER BY insured.u_key,
insured.effective, insured.expiration"
44
45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
46 Dim Comm2 AS SqlDataAdapter
47 Comm2.SelectCommand = New SqlCommand(cmdCore, Conn1)
48 Comm2.SelectCommand.Parameters.Add("@u_key",
DS1.Tables(0).Rows(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>Insured with Losses</title>
64 </head>
65 <body>
66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
67 <asp:Label id="lblDateBegin" width="100%"
runat="Server"></asp:Label>
68 <asp:Label id="lblTimeBegin" 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>



Nov 18 '05 #4
I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error still
shows.
"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:O1**************@TK2MSFTNGP14.phx.gbl...
What do you mean "change code from line 45 to 48"

You still have

45 Dim Comm2 AS SqlDataAdapter
> 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
Line 45 should be

Dim Comm2 as New SQLDataAdapter

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:#m**************@TK2MSFTNGP15.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="System.Data" %>
> 3 <%@ import Namespace="System.Data.SqlClient" %>
> 4 <script runat="server">
> 5
> 6 Sub Page_load(Src AS Object, e AS EventArgs)
> 7 Dim rightNowBegin as DateTime = DateTime.Now
> 8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin) > 9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin) > 10
> 11 Dim Conn1 AS SqlConnection
> 12 Dim Comm1 AS SqlDataAdapter
> 13 Conn1 = new SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> 28
> 29 Dim I AS Integer = 0
> 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> 31 Dim cmdCore As String = ""
> 32 Dim sb As StringBuilder = New StringBuilder("")
> 33 sb.Append("SELECT insured.policy, insured.u_key,

insured.effective, insured.expiration, ")
> 34 sb.Append("insured.status, insured.audit ")
> 35 sb.Append("FROM insured ")
> 36 sb.Append("WHERE insured.u_key = @u_key ")
> 37 sb.Append("ORDER BY insured.u_key, insured.effective, insured.expiration")
> 38 cmdCore = sb.ToString()
> 39 Dim QS1 As String = "SELECT insured.policy,

insured.u_key, insured.effective, insured.expiration, " & _
> 40 "insured.status, insured.audit "
& _ > 41 "FROM insured " & _
> 42 "WHERE insured.u_key = @u_key "
&
_ > 43 "ORDER BY insured.u_key, insured.effective, insured.expiration"
> 44
> 45 Dim Comm2 AS SqlDataAdapter
> 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
> 47 Comm2.SelectCommand.Parameters.Add("@u_key",

DS1.Tables(0).Rows(i).item(0).value)
> 48 Dim cb As SqlCommandBuilder = New

SqlCommandBuilder(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>Insured with Losses</title>
> 64 </head>
> 65 <body>
> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> 67 <asp:Label id="lblDateBegin" width="100%"

runat="Server"></asp:Label>
> 68 <asp:Label id="lblTimeBegin" 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****@aspalliance.com> wrote in message
news:uN****************@TK2MSFTNGP10.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****@golden-isles.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> I am getting Runtime error on line 50. Please Help.
>
> Thank You
> Bill
>
> 1 <%@ Page Language="VB" %>
> 2 <%@ import Namespace="System.Data" %>
> 3 <%@ import Namespace="System.Data.SqlClient" %>
> 4 <script runat="server">
> 5
> 6 Sub Page_load(Src AS Object, e AS EventArgs)
> 7 Dim rightNowBegin as DateTime = DateTime.Now
> 8 lblDateBegin.Text = String.Format("{0:d}",

rightNowBegin) > 9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin) > 10
> 11 Dim Conn1 AS SqlConnection
> 12 Dim Comm1 AS SqlDataAdapter
> 13 Conn1 = new
> SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> 28
> 29 Dim I AS Integer = 0
> 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> 31 Dim cmdCore As String = ""
> 32 Dim sb As StringBuilder = New StringBuilder("")
> 33 sb.Append("SELECT insured.policy, insured.u_key,
> insured.effective, insured.expiration, ")
> 34 sb.Append("insured.status, insured.audit ")
> 35 sb.Append("FROM insured ")
> 36 sb.Append("WHERE insured.u_key = @u_key ")
> 37 sb.Append("ORDER BY insured.u_key, insured.effective, > insured.expiration")
> 38 cmdCore = sb.ToString()
> 39 Dim QS1 As String = "SELECT insured.policy,

insured.u_key,
> insured.effective, insured.expiration, " & _
> 40 "insured.status, insured.audit "
& _ > 41 "FROM insured " & _
> 42 "WHERE insured.u_key = @u_key "
&
_ > 43 "ORDER BY insured.u_key,
> insured.effective, insured.expiration"
> 44
> 45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
> 46 Dim Comm2 AS SqlDataAdapter
> 47 Comm2.SelectCommand = New SqlCommand(cmdCore, Conn1)
> 48 Comm2.SelectCommand.Parameters.Add("@u_key",
> DS1.Tables(0).Rows(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>Insured with Losses</title>
> 64 </head>
> 65 <body>
> 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> 67 <asp:Label id="lblDateBegin" width="100%"
> runat="Server"></asp:Label>
> 68 <asp:Label id="lblTimeBegin" 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>
>
>



Nov 18 '05 #5
The code you included again didn't show your change..

Jeff

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:OY**************@TK2MSFTNGP10.phx.gbl...
I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error still shows.
"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:O1**************@TK2MSFTNGP14.phx.gbl...
What do you mean "change code from line 45 to 48"

You still have

45 Dim Comm2 AS SqlDataAdapter
> > 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
Line 45 should be

Dim Comm2 as New SQLDataAdapter

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:#m**************@TK2MSFTNGP15.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="System.Data" %>
> > 3 <%@ import Namespace="System.Data.SqlClient" %>
> > 4 <script runat="server">
> > 5
> > 6 Sub Page_load(Src AS Object, e AS EventArgs)
> > 7 Dim rightNowBegin as DateTime = DateTime.Now
> > 8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin) > > 9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin) > > 10
> > 11 Dim Conn1 AS SqlConnection
> > 12 Dim Comm1 AS SqlDataAdapter
> > 13 Conn1 = new
SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> > 28
> > 29 Dim I AS Integer = 0
> > 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> > 31 Dim cmdCore As String = ""
> > 32 Dim sb As StringBuilder = New StringBuilder("")
> > 33 sb.Append("SELECT insured.policy, insured.u_key,
insured.effective, insured.expiration, ")
> > 34 sb.Append("insured.status, insured.audit ")
> > 35 sb.Append("FROM insured ")
> > 36 sb.Append("WHERE insured.u_key = @u_key ")
> > 37 sb.Append("ORDER BY insured.u_key, insured.effective, insured.expiration")
> > 38 cmdCore = sb.ToString()
> > 39 Dim QS1 As String = "SELECT insured.policy,
insured.u_key, insured.effective, insured.expiration, " & _
> > 40 "insured.status, insured.audit " &
_
> > 41 "FROM insured " & _
> > 42 "WHERE insured.u_key = @u_key
"
&
_
> > 43 "ORDER BY insured.u_key,
insured.effective, insured.expiration"
> > 44
> > 45 Dim Comm2 AS SqlDataAdapter
> > 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
> > 47 Comm2.SelectCommand.Parameters.Add("@u_key",
DS1.Tables(0).Rows(i).item(0).value)
> > 48 Dim cb As SqlCommandBuilder = New
SqlCommandBuilder(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>Insured with Losses</title>
> > 64 </head>
> > 65 <body>
> > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> > 67 <asp:Label id="lblDateBegin" width="100%"
runat="Server"></asp:Label>
> > 68 <asp:Label id="lblTimeBegin" 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****@aspalliance.com> wrote in message
news:uN****************@TK2MSFTNGP10.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****@golden-isles.com> wrote in message
> news:%2****************@tk2msftngp13.phx.gbl...
> > I am getting Runtime error on line 50. Please Help.
> >
> > Thank You
> > Bill
> >
> > 1 <%@ Page Language="VB" %>
> > 2 <%@ import Namespace="System.Data" %>
> > 3 <%@ import Namespace="System.Data.SqlClient" %>
> > 4 <script runat="server">
> > 5
> > 6 Sub Page_load(Src AS Object, e AS EventArgs)
> > 7 Dim rightNowBegin as DateTime = DateTime.Now
> > 8 lblDateBegin.Text = String.Format("{0:d}", rightNowBegin) > > 9 lblTimeBegin.Text = String.Format("{0:T}", rightNowBegin) > > 10
> > 11 Dim Conn1 AS SqlConnection
> > 12 Dim Comm1 AS SqlDataAdapter
> > 13 Conn1 = new
> > SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> > 28
> > 29 Dim I AS Integer = 0
> > 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> > 31 Dim cmdCore As String = ""
> > 32 Dim sb As StringBuilder = New StringBuilder("")
> > 33 sb.Append("SELECT insured.policy, insured.u_key,
> > insured.effective, insured.expiration, ")
> > 34 sb.Append("insured.status, insured.audit ")
> > 35 sb.Append("FROM insured ")
> > 36 sb.Append("WHERE insured.u_key = @u_key ")
> > 37 sb.Append("ORDER BY insured.u_key,

insured.effective, > > insured.expiration")
> > 38 cmdCore = sb.ToString()
> > 39 Dim QS1 As String = "SELECT insured.policy,
insured.u_key,
> > insured.effective, insured.expiration, " & _
> > 40 "insured.status, insured.audit " &
_
> > 41 "FROM insured " & _
> > 42 "WHERE insured.u_key = @u_key
" &
_
> > 43 "ORDER BY insured.u_key,
> > insured.effective, insured.expiration"
> > 44
> > 45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
> > 46 Dim Comm2 AS SqlDataAdapter
> > 47 Comm2.SelectCommand = New SqlCommand(cmdCore,

Conn1) > > 48 Comm2.SelectCommand.Parameters.Add("@u_key",
> > DS1.Tables(0).Rows(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>Insured with Losses</title>
> > 64 </head>
> > 65 <body>
> > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> > 67 <asp:Label id="lblDateBegin" width="100%"
> > runat="Server"></asp:Label>
> > 68 <asp:Label id="lblTimeBegin" 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>
> >
> >
>
>



Nov 18 '05 #6
I have the code working.

"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The code you included again didn't show your change..

Jeff

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:OY**************@TK2MSFTNGP10.phx.gbl...
I did change line 45 to Dim Comm2 as New SQLDataAdapter. Runtime error still
shows.
"Jeff Dillon" <je**@removeemergencyreporting.com> wrote in message
news:O1**************@TK2MSFTNGP14.phx.gbl...
What do you mean "change code from line 45 to 48"

You still have

45 Dim Comm2 AS SqlDataAdapter
> > > 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)

Line 45 should be

Dim Comm2 as New SQLDataAdapter

"Bill Patel" <bp****@golden-isles.com> wrote in message
news:#m**************@TK2MSFTNGP15.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="System.Data" %>
> > > 3 <%@ import Namespace="System.Data.SqlClient" %>
> > > 4 <script runat="server">
> > > 5
> > > 6 Sub Page_load(Src AS Object, e AS EventArgs)
> > > 7 Dim rightNowBegin as DateTime = DateTime.Now
> > > 8 lblDateBegin.Text = String.Format("{0:d}",

rightNowBegin)
> > > 9 lblTimeBegin.Text = String.Format("{0:T}",

rightNowBegin)
> > > 10
> > > 11 Dim Conn1 AS SqlConnection
> > > 12 Dim Comm1 AS SqlDataAdapter
> > > 13 Conn1 = new
> SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> > > 28
> > > 29 Dim I AS Integer = 0
> > > 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> > > 31 Dim cmdCore As String = ""
> > > 32 Dim sb As StringBuilder = New StringBuilder("")
> > > 33 sb.Append("SELECT insured.policy, insured.u_key,
> insured.effective, insured.expiration, ")
> > > 34 sb.Append("insured.status, insured.audit ")
> > > 35 sb.Append("FROM insured ")
> > > 36 sb.Append("WHERE insured.u_key = @u_key ")
> > > 37 sb.Append("ORDER BY insured.u_key,

insured.effective,
> insured.expiration")
> > > 38 cmdCore = sb.ToString()
> > > 39 Dim QS1 As String = "SELECT insured.policy,
> insured.u_key, insured.effective, insured.expiration, " & _
> > > 40 "insured.status, insured.audit "
&
_
> > > 41 "FROM insured " & _
> > > 42 "WHERE insured.u_key =
@u_key
"
&
_
> > > 43 "ORDER BY insured.u_key,
> insured.effective, insured.expiration"
> > > 44
> > > 45 Dim Comm2 AS SqlDataAdapter
> > > 46 Comm2.SelectCommand = New SqlCommand(QS1, Conn1)
> > > 47 Comm2.SelectCommand.Parameters.Add("@u_key",
> DS1.Tables(0).Rows(i).item(0).value)
> > > 48 Dim cb As SqlCommandBuilder = New
> SqlCommandBuilder(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>Insured with Losses</title>
> > > 64 </head>
> > > 65 <body>
> > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> > > 67 <asp:Label id="lblDateBegin" width="100%"
> runat="Server"></asp:Label>
> > > 68 <asp:Label id="lblTimeBegin" 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****@aspalliance.com> wrote in message
> news:uN****************@TK2MSFTNGP10.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****@golden-isles.com> wrote in message
> > news:%2****************@tk2msftngp13.phx.gbl...
> > > I am getting Runtime error on line 50. Please Help.
> > >
> > > Thank You
> > > Bill
> > >
> > > 1 <%@ Page Language="VB" %>
> > > 2 <%@ import Namespace="System.Data" %>
> > > 3 <%@ import Namespace="System.Data.SqlClient" %>
> > > 4 <script runat="server">
> > > 5
> > > 6 Sub Page_load(Src AS Object, e AS EventArgs)
> > > 7 Dim rightNowBegin as DateTime = DateTime.Now
> > > 8 lblDateBegin.Text = String.Format("{0:d}",

rightNowBegin)
> > > 9 lblTimeBegin.Text = String.Format("{0:T}",

rightNowBegin)
> > > 10
> > > 11 Dim Conn1 AS SqlConnection
> > > 12 Dim Comm1 AS SqlDataAdapter
> > > 13 Conn1 = new
> > >

SqlConnection("server=thales;uid=sa;pwd=36overhaul ;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).Rows.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.ToString()
> > > 28
> > > 29 Dim I AS Integer = 0
> > > 30 DO While I <= DS1.Tables(0).Rows.Count - 1
> > > 31 Dim cmdCore As String = ""
> > > 32 Dim sb As StringBuilder = New StringBuilder("")
> > > 33 sb.Append("SELECT insured.policy, insured.u_key,
> > > insured.effective, insured.expiration, ")
> > > 34 sb.Append("insured.status, insured.audit ")
> > > 35 sb.Append("FROM insured ")
> > > 36 sb.Append("WHERE insured.u_key = @u_key ")
> > > 37 sb.Append("ORDER BY insured.u_key,

insured.effective,
> > > insured.expiration")
> > > 38 cmdCore = sb.ToString()
> > > 39 Dim QS1 As String = "SELECT insured.policy,
> insured.u_key,
> > > insured.effective, insured.expiration, " & _
> > > 40 "insured.status, insured.audit "
&
_
> > > 41 "FROM insured " & _
> > > 42 "WHERE insured.u_key =
@u_key
"
&
_
> > > 43 "ORDER BY insured.u_key,
> > > insured.effective, insured.expiration"
> > > 44
> > > 45 'Comm2 = new SqlDataAdapter(QS1, Conn1)
> > > 46 Dim Comm2 AS SqlDataAdapter
> > > 47 Comm2.SelectCommand = New SqlCommand(cmdCore,

Conn1) > > > 48 Comm2.SelectCommand.Parameters.Add("@u_key",
> > > DS1.Tables(0).Rows(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>Insured with Losses</title>
> > > 64 </head>
> > > 65 <body>
> > > 66 <ASP:DataGrid id="DG1" width="100%" Runat="Server" />
> > > 67 <asp:Label id="lblDateBegin" width="100%"
> > > runat="Server"></asp:Label>
> > > 68 <asp:Label id="lblTimeBegin" 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>
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
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...
5
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. ...
2
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...
12
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...
0
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. ...
0
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...
0
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...
7
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...
3
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...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.