473,385 Members | 1,872 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.

Rephrase of Newby Question!

Hi:

This is the only ASP newsgroup I can access using Verizon, and I would like to know a real
basic piece of information. I am totall new to ASP, although I have done HTML coding.

Say I The following code is intended to ask for an individuals HIRE Number and then pass
it on to a query, which returns time data for the week. It doesn't work, and I can only
assume that the way I have set it up, or the way I am attempting to set or refer to the
variable HIREID, is wrong. It would be an immeasurable help if someone could point out my
error and how I can fix it! It would alsoi be helpful to know how I grab the data that
comes from the query so I can display it.

John Baker
CODE:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI"
Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral,
PublicKeyToken=6f763c9966660626" %>
<script runat="server">

Function MyQueryMethod(ByVal hireNumber As String) As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4;
Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT
[TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri],
[TimeData].[Wed],
[TimeData].[Sat],
[TimeData].[WeekStart],
[TimeData].[AssocName],
[TimeData].[Task_Key],
[TimeData].[PO],
[TimeData].[Mon],
[TimeData].[Tue],
[TimeData].[HireNumber] FROM [TimeData]
WHERE ([TimeData].[HireNumber] = HIREID)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_hireNumber As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_hireNumber.ParameterName = "HIREID"
dbParam_hireNumber.Value = hireNumber
dbParam_hireNumber.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_hireNumber)

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

</script>
<html>
<head>
</head>
<body>
<!-- Insert content here -->
<p align="center">
<img style="WIDTH: 417px; HEIGHT: 179px" height="216" src="IPT logo clear.jpg"
width="472" />
</p>
<p align="center">
<strong style="FONT-SIZE: x-large"><font color="red">IPT Asociates Timesheet
Recording
Process</font></strong>
</p>
<p align="center">
<strong><font color="#ff0000" size="6"></font></strong>
</p>
<p align="center">
</p>
<center>
<form action="intro1.aspx" method="post">
<h3>Hire Number :
<input id="HIREID" type="text" />
<h3>Password :
<input id="Password" type="text" />
</h3>
</h3>
</form>
</center>
</body>
</html>

Nov 19 '05 #1
10 1446
John:
Do you get an exception?

I know using the SqlClient you need to specify parameters with an @ I would
guess OledbClient is the same, ala:

WHERE ([TimeData].[HireNumber] = @HIREID)"
....
dbParam_hireNumber.ParameterName = "@HIREID"

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"John Baker" <Ba******@Verizon.net> wrote in message
news:qp********************************@4ax.com...
Hi:

This is the only ASP newsgroup I can access using Verizon, and I would like to know a real basic piece of information. I am totall new to ASP, although I have done HTML coding.
Say I The following code is intended to ask for an individuals HIRE Number and then pass it on to a query, which returns time data for the week. It doesn't work, and I can only assume that the way I have set it up, or the way I am attempting to set or refer to the variable HIREID, is wrong. It would be an immeasurable help if someone could point out my error and how I can fix it! It would alsoi be helpful to know how I grab the data that comes from the query so I can display it.

John Baker
CODE:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI"
Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral,
PublicKeyToken=6f763c9966660626" %>
<script runat="server">

Function MyQueryMethod(ByVal hireNumber As String) As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT
[TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri],
[TimeData].[Wed],
[TimeData].[Sat],
[TimeData].[WeekStart],
[TimeData].[AssocName],
[TimeData].[Task_Key],
[TimeData].[PO],
[TimeData].[Mon],
[TimeData].[Tue],
[TimeData].[HireNumber] FROM [TimeData]
WHERE ([TimeData].[HireNumber] = HIREID)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_hireNumber As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_hireNumber.ParameterName = "HIREID"
dbParam_hireNumber.Value = hireNumber
dbParam_hireNumber.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_hireNumber)

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

</script>
<html>
<head>
</head>
<body>
<!-- Insert content here -->
<p align="center">
<img style="WIDTH: 417px; HEIGHT: 179px" height="216" src="IPT logo clear.jpg" width="472" />
</p>
<p align="center">
<strong style="FONT-SIZE: x-large"><font color="red">IPT Asociates Timesheet Recording
Process</font></strong>
</p>
<p align="center">
<strong><font color="#ff0000" size="6"></font></strong>
</p>
<p align="center">
</p>
<center>
<form action="intro1.aspx" method="post">
<h3>Hire Number :
<input id="HIREID" type="text" />
<h3>Password :
<input id="Password" type="text" />
</h3>
</h3>
</form>
</center>
</body>
</html>

Nov 19 '05 #2
Try modifying some of your code like this:

' Basically rename your parameters to start with the @ sign
Dim queryString As String = "SELECT [TimeData].[Thu], " & _
" [TimeData].[Sun], [TimeData].[Fri], [TimeData].[Wed], " & _
" [TimeData].[Sat], [TimeData].[WeekStart], [TimeData].[AssocName], " & _
" [TimeData].[Task_Key], [TimeData].[PO], [TimeData].[Mon], " & _
" [TimeData].[Tue], [TimeData].[HireNumber] " & _
"FROM [TimeData] " & _
"WHERE ([TimeData].[HireNumber] = @HIREID)"

Dim dbCommand As System.Data.IDbCommand = _
New System.Data.OleDb.OleDbCommand(queryString, dbConnection)

dbCommand.Parameters.Add("@HIREID", _
System.Data.OleDb.OleDbType.VarChar, 256).Value = hireNumber

If you add a DataGrid to your form, you can point it at the table in your
DataSet to display:

DataGrid1.DataSource = dataSet.Tables(0)
DataGrid1.DataBind()

Alternatively you can iterate the rows using For Each, and display them
individually, etc.

BTW, you might try pointing your newsreader at news.microsoft.com to get
access to all the ms newsgroups.

Hope that helps,
Michael C#

"John Baker" <Ba******@Verizon.net> wrote in message
news:qp********************************@4ax.com...
Hi:

This is the only ASP newsgroup I can access using Verizon, and I would
like to know a real
basic piece of information. I am totall new to ASP, although I have done
HTML coding.

Say I The following code is intended to ask for an individuals HIRE Number
and then pass
it on to a query, which returns time data for the week. It doesn't work,
and I can only
assume that the way I have set it up, or the way I am attempting to set or
refer to the
variable HIREID, is wrong. It would be an immeasurable help if someone
could point out my
error and how I can fix it! It would alsoi be helpful to know how I grab
the data that
comes from the query so I can display it.

John Baker
CODE:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI"
Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral,
PublicKeyToken=6f763c9966660626" %>
<script runat="server">

Function MyQueryMethod(ByVal hireNumber As String) As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB
Services=-4;
Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT
[TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri],
[TimeData].[Wed],
[TimeData].[Sat],
[TimeData].[WeekStart],
[TimeData].[AssocName],
[TimeData].[Task_Key],
[TimeData].[PO],
[TimeData].[Mon],
[TimeData].[Tue],
[TimeData].[HireNumber] FROM [TimeData]
WHERE ([TimeData].[HireNumber] = HIREID)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_hireNumber As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_hireNumber.ParameterName = "HIREID"
dbParam_hireNumber.Value = hireNumber
dbParam_hireNumber.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_hireNumber)

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

</script>
<html>
<head>
</head>
<body>
<!-- Insert content here -->
<p align="center">
<img style="WIDTH: 417px; HEIGHT: 179px" height="216" src="IPT logo
clear.jpg"
width="472" />
</p>
<p align="center">
<strong style="FONT-SIZE: x-large"><font color="red">IPT Asociates
Timesheet
Recording
Process</font></strong>
</p>
<p align="center">
<strong><font color="#ff0000" size="6"></font></strong>
</p>
<p align="center">
</p>
<center>
<form action="intro1.aspx" method="post">
<h3>Hire Number :
<input id="HIREID" type="text" />
<h3>Password :
<input id="Password" type="text" />
</h3>
</h3>
</form>
</center>
</body>
</html>

Nov 19 '05 #3
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion, I am getting an
error, as follows::
.................................................. .................................................. ....
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.
.................................................. .................................................. .....

I assume that this is in the HTML code, but dont know what to do about it.

The code now says:

<%@ Page Language="VB" %>
<script runat="server">

Function GetWeek() As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole
DB Services=-4; Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT [TimeData].[Thu], [TimeData].[Sun],
[TimeData].[Fri], [TimeData].[Wed], [T"& _
"imeData].[Sat], [TimeData].[WeekStart], [TimeData].[AssocName],
[TimeData].[Task"& _
"Key], [TimeData].[PO], [TimeData].[Mon], [TimeData].[Tue],
[TimeData].[HireNumbe"& _
"r] FROM [TimeData] WHERE ([TimeData].[HireNumber] = @INHIRENO)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function' Insert page code here
Dim dbCommand As System.Data.IDbCommand = _
New System.Data.OleDb.OleDbCommand(queryString, dbConnection)

dbCommand.Parameters.Add("@HIREID", _
System.Data.OleDb.OleDbType.VarChar, 256).Value = hireNumber

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<p>
</p>
valid
<hr />
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<form runat="server" action="controls3.aspx">
<font face="Verdana">Please enter your Hire #:
<asp:textbox id=@INHIRENO runat="server"></asp:textbox>
<asp:button id="Button1" onclick="EnterBtn_Click" runat="server"
text="Enter"></asp:button>
<p>
<asp:Label id="Message" runat="server"></asp:Label>
</p>
</font>
</form>
</form>
</body>
</html

Nov 19 '05 #4
If you have Outlook Experss (which comes with every version of Windows), you
have a newsreader, which you can use to go to any Microsoft newsgroup. All
of the public Microsoft newsgroups cqan be found on the msnews.microsoft.com
news server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"John Baker" <Ba******@Verizon.net> wrote in message
news:qp********************************@4ax.com...
Hi:

This is the only ASP newsgroup I can access using Verizon, and I would
like to know a real
basic piece of information. I am totall new to ASP, although I have done
HTML coding.

Say I The following code is intended to ask for an individuals HIRE Number
and then pass
it on to a query, which returns time data for the week. It doesn't work,
and I can only
assume that the way I have set it up, or the way I am attempting to set or
refer to the
variable HIREID, is wrong. It would be an immeasurable help if someone
could point out my
error and how I can fix it! It would alsoi be helpful to know how I grab
the data that
comes from the query so I can display it.

John Baker
CODE:

<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI"
Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral,
PublicKeyToken=6f763c9966660626" %>
<script runat="server">

Function MyQueryMethod(ByVal hireNumber As String) As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB
Services=-4;
Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT
[TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri],
[TimeData].[Wed],
[TimeData].[Sat],
[TimeData].[WeekStart],
[TimeData].[AssocName],
[TimeData].[Task_Key],
[TimeData].[PO],
[TimeData].[Mon],
[TimeData].[Tue],
[TimeData].[HireNumber] FROM [TimeData]
WHERE ([TimeData].[HireNumber] = HIREID)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dbParam_hireNumber As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_hireNumber.ParameterName = "HIREID"
dbParam_hireNumber.Value = hireNumber
dbParam_hireNumber.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_hireNumber)

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function

</script>
<html>
<head>
</head>
<body>
<!-- Insert content here -->
<p align="center">
<img style="WIDTH: 417px; HEIGHT: 179px" height="216" src="IPT logo
clear.jpg"
width="472" />
</p>
<p align="center">
<strong style="FONT-SIZE: x-large"><font color="red">IPT Asociates
Timesheet
Recording
Process</font></strong>
</p>
<p align="center">
<strong><font color="#ff0000" size="6"></font></strong>
</p>
<p align="center">
</p>
<center>
<form action="intro1.aspx" method="post">
<h3>Hire Number :
<input id="HIREID" type="text" />
<h3>Password :
<input id="Password" type="text" />
</h3>
</h3>
</form>
</center>
</body>
</html>

Nov 19 '05 #5
On Tue, 08 Feb 2005 01:51:45 GMT, John Baker <Ba******@Verizon.net>
wrote:
Hi:

This is the only ASP newsgroup I can access using Verizon, and I would like to know a real
basic piece of information. I am totall new to ASP, although I have done HTML coding.


It's the correct newsgroup, that's asp.net you are writing by the
looks of it. :)

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #6
On Tue, 08 Feb 2005 12:24:42 GMT, John Baker <Ba******@Verizon.net>
wrote:
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion, I am getting an
error, as follows::
................................................. .................................................. ....
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.
................................................. .................................................. .....

Have the text box id be something like id="txtHireNumber"

Now where you build the query just concatonate the text property of
the text box into the query.

eg.

Dim SQLQuery As String

SQLQuery = "SELECT * FROM TimeDate WHERE HireNumber = " &
txtHireNumber.Text & ";"

Assuming the Hire number isn't a string of course.

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #7
I'm confused by this question now for some reason. Iain, the code you
provided is pretty dangerous and could very easily lead to an SQL injection.
Always use parameterized values.

John,
it seems like you are adding the @HireId parameter to the command object
AFTER you are executing the code. Also, you name the parameter @HireId when
adding the parameter but @InHireNo in your SQL command. It should look a lo
tmore like:

imports System.Data
imports System.Data.OleDb

Function GetWeek() As DataSet
Dim connectionString As String = "CONNECTION_STRING"
Dim dbConnection As IDbConnection = New OleDbConnection(connectionString)

Dim queryString As String = "SELECT COLUMNS FROM [TimeData] WHERE
([TimeData].[HireNumber] = @Hireid)"
Dim dbCommand As IDbCommand = New OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
dbCommand.Parameters.Add("@HireId", SqlDbType.Int).value = hireNumber

Dim dataAdapter As IDbDataAdapter = New OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As DataSet = New DataSet
try
dataAdapter.Fill(dataSet)
Return dataSet
finally
dbCommand.Dispose()
dataAdapter.Dispose()
end try
end function

Note that I importanted System.Data and System.Data.OleDb to make it more
readable. I also added some cleanup code and I changed a bit of the lengthy
content (liek connection string, and SQL statement) to abbreviate it.

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"teknohippy" <an******@me.com> wrote in message
news:7a********************************@4ax.com...
On Tue, 08 Feb 2005 12:24:42 GMT, John Baker <Ba******@Verizon.net>
wrote:
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion, I am getting anerror, as follows::
................................................. ..........................

.............................
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.


................................................. ..........................

..............................

Have the text box id be something like id="txtHireNumber"

Now where you build the query just concatonate the text property of
the text box into the query.

eg.

Dim SQLQuery As String

SQLQuery = "SELECT * FROM TimeDate WHERE HireNumber = " &
txtHireNumber.Text & ";"

Assuming the Hire number isn't a string of course.

--
Iain Norman | http://www.eliteforum.org

Nov 19 '05 #8
Not recommended. That opens you up to SQL INJECTION.

"teknohippy" <an******@me.com> wrote in message
news:7a********************************@4ax.com...
On Tue, 08 Feb 2005 12:24:42 GMT, John Baker <Ba******@Verizon.net>
wrote:
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion, I
am getting an
error, as follows::
................................................ .................................................. .....
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.
................................................ .................................................. ......

Have the text box id be something like id="txtHireNumber"

Now where you build the query just concatonate the text property of
the text box into the query.

eg.

Dim SQLQuery As String

SQLQuery = "SELECT * FROM TimeDate WHERE HireNumber = " &
txtHireNumber.Text & ";"

Assuming the Hire number isn't a string of course.

--
Iain Norman | http://www.eliteforum.org

Nov 19 '05 #9
Where did @INHIREID come from? You called it @HIREID previously. You need
to match up the parameter name in your SQL Statement with the one in the
Parameters.Add() statement.
"John Baker" <Ba******@Verizon.net> wrote in message
news:4j********************************@4ax.com...
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion, I
am getting an
error, as follows::
.................................................. .................................................. ...
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.
.................................................. .................................................. ....

I assume that this is in the HTML code, but dont know what to do about it.

The code now says:

<%@ Page Language="VB" %>
<script runat="server">

Function GetWeek() As System.Data.DataSet
Dim connectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0; Ole
DB Services=-4; Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT [TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri], [TimeData].[Wed], [T"& _
"imeData].[Sat], [TimeData].[WeekStart], [TimeData].[AssocName],
[TimeData].[Task"& _
"Key], [TimeData].[PO], [TimeData].[Mon], [TimeData].[Tue],
[TimeData].[HireNumbe"& _
"r] FROM [TimeData] WHERE ([TimeData].[HireNumber] = @INHIRENO)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New
System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function' Insert page code here
Dim dbCommand As System.Data.IDbCommand = _
New System.Data.OleDb.OleDbCommand(queryString, dbConnection)

dbCommand.Parameters.Add("@HIREID", _
System.Data.OleDb.OleDbType.VarChar, 256).Value = hireNumber

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<p>
</p>
valid
<hr />
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<form runat="server" action="controls3.aspx">
<font face="Verdana">Please enter your Hire #:
<asp:textbox id=@INHIRENO runat="server"></asp:textbox>
<asp:button id="Button1" onclick="EnterBtn_Click"
runat="server"
text="Enter"></asp:button>
<p>
<asp:Label id="Message" runat="server"></asp:Label>
</p>
</font>
</form>
</form>
</body>
</html

Nov 19 '05 #10
P.S. - You put this code:
Dim dbCommand As System.Data.OlebCommand = _
New System.Data.OleDb.OleDbCommand(queryString, dbConnection)

dbCommand.Parameters.Add("@HIREID", _
System.Data.OleDb.OleDbType.VarChar, 256).Value = hireNumber
Outside your function. It was meant to go inside the function, to replace
the more lengthy versions you posted.

Thx

"Michael C#" <xy*@abcdef.com> wrote in message
news:Jg*****************@fe08.lga... Where did @INHIREID come from? You called it @HIREID previously. You
need to match up the parameter name in your SQL Statement with the one in
the Parameters.Add() statement.
"John Baker" <Ba******@Verizon.net> wrote in message
news:4j********************************@4ax.com...
Gentlemen:

Thank you for your suggestions. Unfortunately following your suggestion,
I am getting an
error, as follows::
.................................................. .................................................. ...
<asp:textbox>
Parser Error: '@INHIRENO' is not a valid identifier.
.................................................. .................................................. ....

I assume that this is in the HTML code, but dont know what to do about
it.

The code now says:

<%@ Page Language="VB" %>
<script runat="server">

Function GetWeek() As System.Data.DataSet
Dim connectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0; Ole
DB Services=-4; Data Source=C:\IPT\Test\Tim"& _
"eData.mdb"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.OleDb.OleDbConnection(connectionString )

Dim queryString As String = "SELECT [TimeData].[Thu],
[TimeData].[Sun],
[TimeData].[Fri], [TimeData].[Wed], [T"& _
"imeData].[Sat], [TimeData].[WeekStart], [TimeData].[AssocName],
[TimeData].[Task"& _
"Key], [TimeData].[PO], [TimeData].[Mon], [TimeData].[Tue],
[TimeData].[HireNumbe"& _
"r] FROM [TimeData] WHERE ([TimeData].[HireNumber] = @INHIRENO)"
Dim dbCommand As System.Data.IDbCommand = New
System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New
System.Data.DataSet
dataAdapter.Fill(dataSet)

Return dataSet
End Function' Insert page code here
Dim dbCommand As System.Data.IDbCommand = _
New System.Data.OleDb.OleDbCommand(queryString, dbConnection)

dbCommand.Parameters.Add("@HIREID", _
System.Data.OleDb.OleDbType.VarChar, 256).Value = hireNumber

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
<p>
</p>
valid
<hr />
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<form runat="server" action="controls3.aspx">
<font face="Verdana">Please enter your Hire #:
<asp:textbox id=@INHIRENO runat="server"></asp:textbox>
<asp:button id="Button1" onclick="EnterBtn_Click"
runat="server"
text="Enter"></asp:button>
<p>
<asp:Label id="Message" runat="server"></asp:Label>
</p>
</font>
</form>
</form>
</body>
</html


Nov 19 '05 #11

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

Similar topics

9
by: Damien | last post by:
I have just built a simple stopwatch application, but when i f5 to get things goings i get this message, An unhandled exception of type 'System.ArithmeticException' occurred in...
0
by: Pete | last post by:
Hi All, A total Newby with, possibly, a daft question? However, until I can get a reasonable explanation I am disinclined towards going further. Here goes: I recently downloaded the latest...
8
by: Ask | last post by:
G'day All, Just thought I'd drop in and say hi. I'm new to Python, but old to software development. Python is one of the languages used in my new job, so I've just bought a book, read it, and...
10
by: Fred Nelson | last post by:
Hi: I have programmed in VB.NET for about a year and I'm in the process of learing C#. I'm really stuck on this question - and I know it's a "newby" question: In VB.NET I have several...
4
by: Fred Nelson | last post by:
I have an applicatioin that I'm writing that uses a "case" file that contains over 350 columns and more may be added in the future. I would like to create a dataset with all the column names and...
4
by: Fred Nelson | last post by:
Hi: I'm developing a web application that needs to have five values, each retrieved from cookies on many pages. If I have five "Request.Cookies" commands together does this cause five "round...
2
by: Fred Nelson | last post by:
Hi: I'm working on a VS2005 web application and I have what is probabably a "newby" question. In VS2003 I could drag a textbox/button/etc on to a form and position it with the mouse. I...
2
by: johnnyG | last post by:
Greetings, I'm studying for the 70-330 Exam using the MS Press book by Tony Northrup and there are 2 side-by-side examples of using the SHA1CryptoServiceProvider to create a hash value from a...
10
by: Charles Russell | last post by:
Why does this work from the python prompt, but fail from a script? How does one make it work from a script? #! /usr/bin/python import glob # following line works from python prompt; why not in...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...

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.