Ask a Question related to ASP Database, Design and Development.
-
William E Hatto #1
checking names in a database
Hi all,
I have an asp page that accesses a database. The code below checks to make
sure that a username and their full names do not already exist in the
database. I am relatively new to ADO.
The first group returns an answer, the second code group, when inserted
causes an error.
What is a better alternative to this?
(ps watch wrap)
strSQL = "SELECT UserName FROM tblUser WHERE ((UserName='" & Name & "') AND
(ID<>" & FormID & "))"
MyRS.Open strSQL, MyCN, 3
If MyRS.RecordCount > 0 Then Exist = True: EMode = True
strSQL = "SELECT FullName FROM tblUser WHERE ((FullName='" & FName & "')
AND (ID<>" & FormID & "))"
MyRS.Open strSQL, MyCN, 3
If MyRS.RecordCount > 0 Then Exist = True: EMode = True
Cheers, Bill.
William E Hatto Guest
-
Passing database column names as varable
I've tried all night to figure this one out..And I can't seem to find the answear on the forums.. I've made a CustomTag-file that need these... -
Database table names
In the database tab of the Application panel, when I go down the hierachy to the tables dreamweaver shows the full path instead of just the table... -
querying table names in a database
Hey Gang - Anyone have a fast and easy CFQUERY that can query all the table names in an Access database? TIA -
Get database field names from table...
How do you get the database fieldnames from a table and display them using cfquery and cfoutput. Thanks a million... -
Checking which version of Jet a database is using
How do I tell which version of Jet particular Access 2000 database is using? I'm trying to use the proper OLE-DB settings to access it via ASP and... -
Ray at #2
Re: checking names in a database
What error?
How about:
strSQL = "SELECT UserName FROM tblUser WHERE (((UserName='" & Name & "' OR
Fullname='" & FName & "') AND
(ID<>" & FormID & "))"
Set MyRS = MyCN.Execute(strSQL)
EMode = Not MyRS.EOF
MyRS.Close : Set MyRS = Nothing
Not tested!
Ray at work
"William E Hatto" <xxnospamxxweh@bigpond.net.au> wrote in message
news:eZnMEmvIEHA.364@TK2MSFTNGP11.phx.gbl...AND> Hi all,
>
> I have an asp page that accesses a database. The code below checks to make
> sure that a username and their full names do not already exist in the
> database. I am relatively new to ADO.
>
> The first group returns an answer, the second code group, when inserted
> causes an error.
> What is a better alternative to this?
>
> (ps watch wrap)
>
> strSQL = "SELECT UserName FROM tblUser WHERE ((UserName='" & Name & "')> (ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
> strSQL = "SELECT FullName FROM tblUser WHERE ((FullName='" & FName & "')
> AND (ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
>
> Cheers, Bill.
>
>
Ray at Guest
-
Ray at #3
Re: checking names in a database
P.S. Do you really expect to never have two people with the same name?
There are many, many John Smiths in the world. Be careful with how you're
doing this, because you may wind up mixing data together that belong to
different people...
Ray at work
"William E Hatto" <xxnospamxxweh@bigpond.net.au> wrote in message
news:eZnMEmvIEHA.364@TK2MSFTNGP11.phx.gbl...AND> Hi all,
>
> I have an asp page that accesses a database. The code below checks to make
> sure that a username and their full names do not already exist in the
> database. I am relatively new to ADO.
>
> The first group returns an answer, the second code group, when inserted
> causes an error.
> What is a better alternative to this?
>
> (ps watch wrap)
>
> strSQL = "SELECT UserName FROM tblUser WHERE ((UserName='" & Name & "')> (ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
> strSQL = "SELECT FullName FROM tblUser WHERE ((FullName='" & FName & "')
> AND (ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
>
> Cheers, Bill.
>
>
Ray at Guest
-
Jeff Cochran #4
Re: checking names in a database
On Thu, 15 Apr 2004 22:53:50 +0800, "William E Hatto"
<xxnospamxxweh@bigpond.net.au> wrote:
And the error is...?>Hi all,
>
>I have an asp page that accesses a database. The code below checks to make
>sure that a username and their full names do not already exist in the
>database. I am relatively new to ADO.
>
>The first group returns an answer, the second code group, when inserted
>causes an error.
Jeff
>What is a better alternative to this?
>
>(ps watch wrap)
>
> strSQL = "SELECT UserName FROM tblUser WHERE ((UserName='" & Name & "') AND
>(ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
> strSQL = "SELECT FullName FROM tblUser WHERE ((FullName='" & FName & "')
>AND (ID<>" & FormID & "))"
> MyRS.Open strSQL, MyCN, 3
> If MyRS.RecordCount > 0 Then Exist = True: EMode = True
>
>
>Cheers, Bill.
>Jeff Cochran Guest
-
+FarmerPickles #5
Re: checking names in a database
I am thinking that the only time i would check for a duplicate name, is if
this was something that someone created a user name.. ie: nickname
FP
"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:407eb3f1.12290002@msnews.microsoft.com...make> On Thu, 15 Apr 2004 22:53:50 +0800, "William E Hatto"
> <xxnospamxxweh@bigpond.net.au> wrote:
>> >Hi all,
> >
> >I have an asp page that accesses a database. The code below checks toAND>> >sure that a username and their full names do not already exist in the
> >database. I am relatively new to ADO.
> >
> >The first group returns an answer, the second code group, when inserted
> >causes an error.
> And the error is...?
>
> Jeff
>> >What is a better alternative to this?
> >
> >(ps watch wrap)
> >
> > strSQL = "SELECT UserName FROM tblUser WHERE ((UserName='" & Name & "')>> >(ID<>" & FormID & "))"
> > MyRS.Open strSQL, MyCN, 3
> > If MyRS.RecordCount > 0 Then Exist = True: EMode = True
> >
> > strSQL = "SELECT FullName FROM tblUser WHERE ((FullName='" & FName & "')
> >AND (ID<>" & FormID & "))"
> > MyRS.Open strSQL, MyCN, 3
> > If MyRS.RecordCount > 0 Then Exist = True: EMode = True
> >
> >
> >Cheers, Bill.
> >
+FarmerPickles Guest



Reply With Quote

