473,386 Members | 1,812 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,386 software developers and data experts.

information already on file problem - Reader.HasRows

7
Hi,

i created a register form on a website. The information from the form has to go in the customer table in a database in MS Access.

the information is going into the table perfectly. however, if i don't want a repeat of information and the system checks to see if the user is already in the database i get an error. it's either i get the error message "The user name you entered is already on file." all the time

or if i put "Not reader.HasRows" then the information is inputted into the database no matter if it is already there.

Dim cmdText As String = "SELECT * FROM Customer"

Dim command As OleDbCommand

command = New OleDbCommand(cmdText, myConnection)

Dim reader As OleDbDataReader

reader = command.ExecuteReader

Dim autonumber As Integer



Dim check As Integer

check = Microsoft.VisualBasic.Val("CustomerID")

If check < Microsoft.VisualBasic.Val("CustomerID") Then



autonumber = check

End If



If reader.HasRows Then

Me.RegistrationMessage.Text = "The user name you entered is already on file."

reader.Close()

Return

Else

cmdText = "INSERT INTO Customer (FirstName, LastName, Address, Country, PhoneNo, Email, UserName, [Password]) VALUES ('" + FirstName.Text + "','" + LastName.Text + "','" + Address.Text + "','" + Country.Text + "','" + PhoneNo.Text + "','" + Email.Text + "','" + UserName1.Text + "','" + Password1.Text + "')"

command = New OleDbCommand(cmdText, myConnection)

command.ExecuteNonQuery()

Response.Redirect("RegistrationApproved.aspx")


End If

End Using

can anyone help me please?
Aug 7 '08 #1
0 1499

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: charliewest | last post by:
Is there a .Net Compact Framework equivalent in the system.data.sqlserverce namespace of the .Net Framework system.data.sqlclient DataReader object's "Has.Rows" method? For example: ...
1
by: Claudia Fong | last post by:
Hi, I'm using the oleDbDataReader HasRows properties to detect wheter my table contains a record with the parameter below: oleDbConnection1.Close(); objreturnst.Parameters.Value =...
0
by: z. f. | last post by:
Hi, i have asp.net vb.net wep application. i try to investigate performance issue. so first i built a vb.net windows application that makes http requests to my pages and show me the time taken...
2
by: Danny Gagne | last post by:
I'm currently working an .net application (I can use 1.1 or 2.0 if needed) that needs to read a wsdl file and generate another piece of code that can use it. I'm encountering a problem where I...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
2
by: rn5a | last post by:
The following code resides in a VB class file name GetOrder.vb (this class file exists in the App_Code directory): Namespace Shop Public Class Orders Public Function ViewOrder(ByVal UserID As...
0
by: mwmorrison93 | last post by:
Hello, I'm at my wit's end regarding the "The state information is invalid for this page and might be corrupted" error and I'm hoping someone can provide some assistance. I working with C#/ASP.NET...
1
by: weird0 | last post by:
The property of GridView1.HasRows is true and after assigning GridView.DataSource=reader, it does not display any records in the GirdView. I am i missing out something? Here is the code:...
0
by: ashes | last post by:
Hi all, In Ms Access, I have a Customer table and a Credit Card table. The CustomerID field is a primary key in the Credit Card table. Both tables already have sample data in it. So, when a...
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: 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
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
marktang
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,...
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.