Thanks for that.
Now I'm getting this:
Server Error in '/messenger' Application.
--------------------------------------------------------------------------------
The SELECT permission was denied on the object 'Users', database 'SurfMessenger', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Users', database 'SurfMessenger', schema 'dbo'.
Source Error:
Line 187: {
Line 188: conn.Open();
Line 189: Object result = cmd.ExecuteScalar();
Line 190: return result != null;
Line 191: }
Source File: c:\inetpub\vhosts\domain.co.uk\httpdocs\messenger\register.aspx Line: 189
Stack Trace:
[SqlException (0x80131904): The SELECT permission was denied on the object 'Users', database 'SurfMessenger', schema 'dbo'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteScalar() +137
ASP.register_aspx.IsUsernameExists(String username) in c:\inetpub\vhosts\domain.co.uk\httpdocs\messenger\register.aspx:189
ASP.register_aspx.DoRegNewUser(String username, String password, String location, String occupation, String interests, Boolean gender, Int32 age) in c:\inetpub\vhosts\domain.co.uk\httpdocs\messenger\register.aspx:128
ASP.register_aspx.btnReg_Click(Object sender, EventArgs e) in c:\inetpub\vhosts\domain.co.uk\httpdocs\messenger\register.aspx:220
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
I've created a user 'test' in SQL Server and assigned it to the database.