i need help to check the avaialbility of username from database. i am developing this website in a .net 3 tier framework. i already search for coides through google but all the codes are in 2 tier based. please help..............
Don't get so hung up on "3 tier" and stuff like that.
You have a very specific problem you are trying to solve so just focus on that alone.
What you need to do is run a query against your database to check if a value exists. That's it.
publicbool UserNameExists( string username )
// Connect to your database...// Run a query to check if username exists. // NOTE: Use a paramatarized query.// Something like: SELECT count(*) FROM [YourUserTable] WHERE [YourUserNameColumn] = @username
hi i am trying to read NTFS share permission. Imported
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]<br/>
protected struct SHARE_INFO_2<br/>
public string NetName;<br/>
public ShareType ShareType;<br/>
public string Remark;<br/>
public int Permissions;<br/>
public int MaxUsers;<br/>
public int CurrentUsers;<br/>
public string Path;<br/>
public string Password;<br/>
Don't. If you have a recordId, assume it exists and delete it - catch the exception if it did not. Adding checks like the one you proposed might say it exist, and still be deleted (by someone else) an instance later (unless it's an atomic operation, which I doubt).
if you delete it while it doesn't exist SQL will return something like: "0 rows deleted".
Deletefrom tableX where myconstraint='Myconstraint';
--> query returned in 10 ms: 0 rows deleted
If you do it in code you can get that by reading out the NrOfRowsAffected property when doing an ExecuteNonQuery statement. Same goes for Insert and Update queries eg.
as someone already replied, checking if it exists is inaccurate at best and doesn't add any functional advantage.
if you really, really must check it. Perform a select query perhaps with a count.
Select count(id) from tableX where myconstraint='Myconstraint'
Hey folks!! Hope you can help me with my client code.
Först I debugg the Server wich is an consoleapplication and the server starts, secondly I debugg the Client, I put a nickname value to the nickNameTextBox and click on Connect (button2) the compiler stops at this code line
from the button 2 handler - unless you have pressed Button1 first, the connection has not been established and it will likely throw an exception - probably the one you are complaining about.
Personally, I would have a "Connect" method, which checked if you are connected and does so if not - and call it from both click events. (I would probably also make it return the stream instead of using a class level variable directly in the two event handlers).
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
Thank you mate I appreciate your help, I changed it to this code,
the reason I commented out
because the compiler stops there when I debugg telling me that a socket is already connected, now the compiler runs withour errors but the server consoleAppplication doesn't receive any msg at all when I send it from sendTextBox..
privatevoid button1_Click(object sender, EventArgs e)
if (serverStream == null)
MessageBox.Show("Please connect to a server.");
readData = "Conected to Chat Server ...";
serverStream = clientSocket.GetStream();
byte outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
Thread ctThread = new Thread(getMessage);
The compiler stops on this code under the getMessage method
"Failed to read data from the transport connection: An existing connection was forced to close by the remote host." It havens because I closed the Server... Anyway this project is driving me crazy man I can't see why it's not working and the Server doesn't get and show the string on the server prompt from the Client
In a C# 2010 desktop application, I need to add an audit table to an application that would be similar to the 'main' table. Basically whenever anyting is changed in the 'main' table I need to show the corresponding change in the 'audit' table. The 'audit' table will be a mirror copy of the 'main' table. The only difference is one table is called 'main' table and the other table is called the 'audit' table.
**Note these table reside in a sql server 2008 r2 database.
Would you setup a trigger? If so, can you show me the sql you would use?
Would you write C#.net 2010 code? If so, can you show me the code that would solve my problem?
Let's say you have a table containing customer orders. An order has an ID, a status, and a number of other things including creation date and user. As the order is processed, the status will change and you want to be able to report each status change.
Rather than having one row and overwriting the previous values, you can create a new row with the new values.
In this way you can easily see the details of an order's life all in one table. When a new state is created, the only change you make to the previous state is to set the NextID field. And the current record is the one with NextID==null.
I need to create a desktop application using C# as frontend and postgresql/postgis for the database.
I have google maps V3 embedded into web browser control.
My question is, is there any way to visualize geometry column of postgis into google maps using C#.