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

need immediate help

hi,
i m rajasavi.have just studied learning VB.net and need some help .i m making small window application using database about getting verfiying password before entering the other page.but my problem how to apply the constraint that only 1 user should have same name..should i use the constarint in database or should is there anyway of checking this in aplication code.

also help me out of hw to use ILDASM as it gives error P.E cannot be created
Oct 2 '06 #1
5 1322
radcaesar
759 Expert 512MB
hi,
i m rajasavi.have just studied learning VB.net and need some help .i m making small window application using database about getting verfiying password before entering the other page.but my problem how to apply the constraint that only 1 user should have same name..should i use the constarint in database or should is there anyway of checking this in aplication code.

also help me out of hw to use ILDASM as it gives error P.E cannot be created

Make ur UserName Column as a Unique Column in DB and catch the exception in the c# code when the user tries to insert a duplicate user name
Oct 3 '06 #2
Hi,
You can impose that constraint of ensuring unique users in the application code itself. Check whether the name entered in the textbox(username) is already exists in the table(in database) by parsing through the records...

for ex:
.....
.....
dataAdapter.Fill(dataSet);
int userFound=0;
int i=0;
for(i=0;i<dataSet.Tables[0].Rows.Count;i++)
{
if(dataSet.Tables[0].Rows[i][0].ToString()==txtUser.Text)
userFound=1;
if(userFound==1)
break;
}
if(userFound==1)
// error
else
// User exists

Hope this is useful....
Oct 5 '06 #3
Oh god that looked complex, make your select statement like this.
//
public bool UserExists
{
get
{
string select = "SELECT Username FROM Users WHERE Username = '" + UsernameVariable + "'";

//I'll assume you already have a SqlDataConnection called sqlConn

DataAdapter da = new DataAdapter(select,sqlConn)
DataTable dt = new DataTable();
da.Fill(dt);
return dt.Rows.Count >0
}
}
Oct 6 '06 #4
Now with that code you could easily verify that the user exists without iterating through all the rows (which costs performance), plus returning a massive amount of rows from SQL costs performance, and memory.

Now to use this, it's real easy. Before saving just do this.

if(UserExists)
{
MessageBox.Show("This username is already in use!","Error",MessageBoxButtons.Ok,MessageBoxIcon. Error);
}
else
{
SaveUserMethod();
}
Oct 6 '06 #5
Please give more feedback on ILDASM, in order to use the disassembly module the component has to be a .NET component, otherwise you would have to use tlbimp.exe to translate the component to .NET.
Oct 6 '06 #6

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

Similar topics

4
by: MegaZone | last post by:
I'm having some issues with PHP DOMXML - in particular the get_elements_by_tagname method. Now, the PGP docs on this are, well, sparse, so maybe I'm just doing something stupid. I thought this...
4
by: finlma | last post by:
I'm trying to run an EXECUTE IMMEDIATE within a PL/SQL if loop but it doesn't work for me. I'm trying to create a column conditionally but it doesn't work. It fails because there are apostrophes...
2
by: AGB | last post by:
Hi all, I have the following simple XML file. I would like to load all the values in the Name nodes into a drop-down list box: <?xml version="1.0" encoding="utf-8" ?> <OutlineCodeNames>...
2
by: Jon Davis | last post by:
How do I get the Immediate window back? It seems to be gone. Command window doesn't work. "View" menu items don't seem to show it Jon
3
by: Russell Stevens | last post by:
Can anyone tell me how to get to the immediate window in VS2005. The help file says (when debugging) to click Debug, Windows, Immediate. There is no Immediate window listed there, nor anywhere else...
0
by: prashant | last post by:
Hi, I am trying to set up Transactional replication with immediate updation. The configuration is as follows: 1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the...
2
by: dgk | last post by:
Using VS2005 Standard Edtion, I have an Immediate window during ASP debugging. My co-worker, using VS2005 Team Edtion does not have an Immediate window. He does have a Command window, which is sort...
4
by: kiss deez | last post by:
Hello, I am trying to test various math functions through the immediate window while in design mode (I have a 64 bit system). For example, I have the following function: Public Function...
6
by: Frank Rizzo | last post by:
I am using the Immediate Window a lot to see the progress of the application. In VS2003, if your cursor was at the very bottom, the window would scroll down whenever something new showed up. If...
3
by: BD | last post by:
I'm doing some cross-platform development, under LUW 8.2 (Windows) for z/OS 8. I have some fairly complex queries which address some rather large tables. One query takes approximately 30...
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: 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
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
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
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.