Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Thursday, March 29, 2012

Database Connection

hi everybody;
my questions about when database connection :
i am when connecting database latter receiveing exception error.Error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
codes :
SqlCeConnection cnn=new SqlCeConnection("Datasource=\\My Documents\\Business\\LOREAL.sdf");
cnn.Open(); // Exception is here
help me..
can i doing ?

Moving it to Sql Mobile forum, when it has got better chance of being answered.

-Thanks,

Mohit

|||

Does the file exist in the path shown ?

Try to catch SqlCeException. That will show why it failed. Take a look at the VS 2005 docs on SqlCeException example.

Thank you!

Syed N. Yousuf

Microsoft Developer Support Professional

This posting is provided “AS IS” with no warranties, and confers no rights.

DataBase Connection

hi everybody;
my questions about when database connection :
i am when connecting database latter receiveing exception error.Error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
codes :
SqlCeConnection cnn=new SqlCeConnection("Datasource=\\My Documents\\Business\\LOREAL.sdf");
cnn.Open(); // Exception is here
help me..
can i doing ?

Mehmet,

Try the code below instead - it fixes your connection string and provides you with a way to get more information about specific exceptions you may encounter using SQL Mobile.

-Darren

try

{

SqlCeConnection cnn = new SqlCeConnection(@."Data Source = \My Documents\Business\LOREAL.sdf");

cnn.Open();

}

catch (SqlCeException sqlex)
{
DisplaySQLCEErrors(sqlex);

}

public void DisplaySQLCEErrors(SqlCeException ex)
{
SqlCeErrorCollection errorCollection = ex.Errors;

StringBuilder bld = new StringBuilder();
Exception inner = ex.InnerException;

foreach (SqlCeError err in errorCollection)
{
bld.Append("\n Error Code: " + err.HResult.ToString("X"));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);

foreach (int numPar in err.NumericErrorParameters)
{
if ( 0 != numPar ) bld.Append( "\n Num. Par. : " + numPar );
}

foreach ( string errPar in err.ErrorParameters )
{
if ( String.Empty != errPar ) bld.Append( "\n Err. Par. : " + errPar );
}

MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
bld.Remove(0, bld.Length);
}
}

|||thank you Darren for my tring
and i am writing error Message :
ErrorCode:80004005
Message : There is a file sharing violation. A different process might be using the file.[,,,,,]
Mino Error .: 25035
Source: Microsoft SQL Server 2000 Windows CE Edition
Err.Par.:\My Documents\Business\LOREAL.sdf

help me (:|||

Something else on your device has a lock on the .SDF file. Try soft-resetting the device and run your code again. If that doesn't work, you may not have a clean install of SQL Mobile on the device.

Regards,

Darren

|||thank you Darren very very much
i am tring now and when being error message i will write is here (:|||but not do Darren..
i am reset machine and later i was set to program and i was install my application. but not did.
again same error...
can i doing ?
please help....|||

Mehmet,

Can you open the .sdf file using Query Analyzer 3.0 on your device? If that works and your application cannot create a connection to the database, there is some problem in your code and I'd ask you to post more of your code. If you cannot open the database with Query Analyzer 3.0, I'd be interested to know what error is reported. The error you are getting indicates that the .sdf fileis locked, but SQL Mobile is a multi-user database and can accept multiple connections. The only thing that I know of that would lock the entire database would be that you are running a Compact, AutoFlush, or merge repl with AddOption.CreateDatabase while you have code that is trying to connect to it. And it doesn't sound like that is the case.

Are you sure you have a good install of SQL Mobile and that the .sdf file is valid? How did you create your .sdf file?

Darren

|||hi again...
i am using SQL CE 2.0 in dotnet 2003 .
and my database running in PDA. and it s running on QueryAnalyzer.
but i am not connection database on codebehind in .net. and i sent code to you.
or i did writing code for create database on codebehind. Then creating database on PDA but again i am not connected database ):
and when i not connection open database later i am not running ExecuteReader or ExecuteNonQuery on PDA.
but no problem PDA.|||

SQL CE 2.0 allows only one connection to database, QA connection counts. Make sure to exit QA or you won't be able to open this database.

|||but my code is correct and my code is running on Windows Application.but not running on PDA application.
i reseted pda , i installed QA and i installed my program.
but again not running.
usually error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
connection.Open(); /// exception is here
or not running code is : SqlDataAdapter.Fill(DataTable); // not running code..|||

I’m not quite sure how your code can run on Windows application because SQL Server CE 2.0 is not available on desktop. Even if it does, it does not mean it would run unchanged on device.

This exception you're getting means something wrong with your code, data and/or environment. Error messages in the exception would tell you what it is, so you can fix your application code, data or environment.

If that's the same message as before, please make sure you're not running another copy of your application, you do not open more than one connection to the same DB from your application and you do not have Query Analyzer running at the same time as your application.

|||

pls help me as soon as possible.I am getting an error as

An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll

|||first only not running your database (sdf) on query analyzer..
usually your code first : connection.open()
command.ExecuteNonQuery();
connection.Close();
for example.....
if you opened connection and end your process later close connection...|||Hi, Darren;
I am facing this same problem.
I am quite sure that no other process is trying to connect my .sdf file.
My code is:
....
conn.Close();
conn.Open();//open connection just after close; throw exception.

The reason that close connection and open again is that if I still use this open connection (passed in as parameter), I got exception sth like "...connection is Fetching...". So I close and then open it. It works most of the time, but it throws that exception. I looks like connection hasn't been closed but try to open it again. I add code:
...
conn.Close();
int count = 0;
while (conn.State != ConnectionState.Closed)
{
Thread.Sleep(250);
if(count>4)
break;
count++;
}
conn.Open();
...
it still throws that exception.
How can I fix that problem?

Thank u very much.

|||

Hi everbody,

I have a problem like this.There is a programme on PDA and it has a (.sdf) database .When I trying to start program,I got this error : "not access to user table" and then "it will be upgrade" and then "25035: There is a file sharing violation.A different process might be using the file"

and when I look at the database,I saw three tables: MSysConstraints,MSysObjects,MSysRDATombstone.

I supposed that the database havent a "user table" ,but I dont know what serve the three tables on the database.

thanks much..

DataBase Connection

hi everybody;
my questions about when database connection :
i am when connecting database latter receiveing exception error.Error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
codes :
SqlCeConnection cnn=new SqlCeConnection("Datasource=\\My Documents\\Business\\LOREAL.sdf");
cnn.Open(); // Exception is here
help me..
can i doing ?

Mehmet,

Try the code below instead - it fixes your connection string and provides you with a way to get more information about specific exceptions you may encounter using SQL Mobile.

-Darren

try

{

SqlCeConnection cnn = new SqlCeConnection(@."Data Source = \My Documents\Business\LOREAL.sdf");

cnn.Open();

}

catch (SqlCeException sqlex)
{
DisplaySQLCEErrors(sqlex);

}

public void DisplaySQLCEErrors(SqlCeException ex)
{
SqlCeErrorCollection errorCollection = ex.Errors;

StringBuilder bld = new StringBuilder();
Exception inner = ex.InnerException;

foreach (SqlCeError err in errorCollection)
{
bld.Append("\n Error Code: " + err.HResult.ToString("X"));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);

foreach (int numPar in err.NumericErrorParameters)
{
if ( 0 != numPar ) bld.Append( "\n Num. Par. : " + numPar );
}

foreach ( string errPar in err.ErrorParameters )
{
if ( String.Empty != errPar ) bld.Append( "\n Err. Par. : " + errPar );
}

MessageBox.Show( bld.ToString(), "SQL Server CE Error" );
bld.Remove(0, bld.Length);
}
}

|||thank you Darren for my tring
and i am writing error Message :
ErrorCode:80004005
Message : There is a file sharing violation. A different process might be using the file.[,,,,,]
Mino Error .: 25035
Source: Microsoft SQL Server 2000 Windows CE Edition
Err.Par.:\My Documents\Business\LOREAL.sdf

help me (:|||

Something else on your device has a lock on the .SDF file. Try soft-resetting the device and run your code again. If that doesn't work, you may not have a clean install of SQL Mobile on the device.

Regards,

Darren

|||thank you Darren very very much
i am tring now and when being error message i will write is here (:|||but not do Darren..
i am reset machine and later i was set to program and i was install my application. but not did.
again same error...
can i doing ?
please help....|||

Mehmet,

Can you open the .sdf file using Query Analyzer 3.0 on your device? If that works and your application cannot create a connection to the database, there is some problem in your code and I'd ask you to post more of your code. If you cannot open the database with Query Analyzer 3.0, I'd be interested to know what error is reported. The error you are getting indicates that the .sdf fileis locked, but SQL Mobile is a multi-user database and can accept multiple connections. The only thing that I know of that would lock the entire database would be that you are running a Compact, AutoFlush, or merge repl with AddOption.CreateDatabase while you have code that is trying to connect to it. And it doesn't sound like that is the case.

Are you sure you have a good install of SQL Mobile and that the .sdf file is valid? How did you create your .sdf file?

Darren

|||hi again...
i am using SQL CE 2.0 in dotnet 2003 .
and my database running in PDA. and it s running on QueryAnalyzer.
but i am not connection database on codebehind in .net. and i sent code to you.
or i did writing code for create database on codebehind. Then creating database on PDA but again i am not connected database ):
and when i not connection open database later i am not running ExecuteReader or ExecuteNonQuery on PDA.
but no problem PDA.|||

SQL CE 2.0 allows only one connection to database, QA connection counts. Make sure to exit QA or you won't be able to open this database.

|||but my code is correct and my code is running on Windows Application.but not running on PDA application.
i reseted pda , i installed QA and i installed my program.
but again not running.
usually error is : An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
connection.Open(); /// exception is here
or not running code is : SqlDataAdapter.Fill(DataTable); // not running code..|||

I’m not quite sure how your code can run on Windows application because SQL Server CE 2.0 is not available on desktop. Even if it does, it does not mean it would run unchanged on device.

This exception you're getting means something wrong with your code, data and/or environment. Error messages in the exception would tell you what it is, so you can fix your application code, data or environment.

If that's the same message as before, please make sure you're not running another copy of your application, you do not open more than one connection to the same DB from your application and you do not have Query Analyzer running at the same time as your application.

|||

pls help me as soon as possible.I am getting an error as

An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll|||first only not running your database (sdf) on query analyzer..
usually your code first : connection.open()
command.ExecuteNonQuery();
connection.Close();
for example.....
if you opened connection and end your process later close connection...|||Hi, Darren;
I am facing this same problem.
I am quite sure that no other process is trying to connect my .sdf file.
My code is:
....
conn.Close();
conn.Open();//open connection just after close; throw exception.

The reason that close connection and open again is that if I still use this open connection (passed in as parameter), I got exception sth like "...connection is Fetching...". So I close and then open it. It works most of the time, but it throws that exception. I looks like connection hasn't been closed but try to open it again. I add code:
...
conn.Close();
int count = 0;
while (conn.State != ConnectionState.Closed)
{
Thread.Sleep(250);
if(count>4)
break;
count++;
}
conn.Open();
...
it still throws that exception.
How can I fix that problem?

Thank u very much.

|||

Hi everbody,

I have a problem like this.There is a programme on PDA and it has a (.sdf) database .When I trying to start program,I got this error : "not access to user table" and then "it will be upgrade" and then "25035: There is a file sharing violation.A different process might be using the file"

and when I look at the database,I saw three tables: MSysConstraints,MSysObjects,MSysRDATombstone.

I supposed that the database havent a "user table" ,but I dont know what serve the three tables on the database.

thanks much..

sql

Database Connection

Still new here, please be gentle.

I created a database inside SQL. I made my tables,etc.

When I try to connect to it from VBE I cannot open it!

I get an error stating that I cannot connect to it.

Am I doing the right thing?

If I create an SQL db from within VBE, I run into issues. I would rather not install the db's into my project since this will be a shared app.

Could some give me a little advice or point me in the right direction, please.

Davids Learning

IF I HAD ONLY TOOK ABOUT 8 HOURS

I COULD HAVE SOLVE MY OWN PROBLEM

READ BLOGS MORE

Davids Learning

database connection

i make a device of access card when i connect database to serial port it dosen't work

Could you please elaborate on how exactly you connect a database to a serial port of an access card?

database connection

i make a device of access card when i connect database to serial port it dosen't work

Could you please elaborate on how exactly you connect a database to a serial port of an access card?

database connection

I am not able to connect to my database. When I run the following, I get the meassage
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
Although SQL SERVER 2000 WINCC is very much running.Trying to solve the problem for days now. Pl help.

pcg

<%@. Page Language="C#" Debug="true" Trace="true" %>
<%@. import Namespace="System.Data.SqlClient" %>
<%@. import Namespace="System.Data" %>
<script runat="server">

// Insert page code here
//
void addtosalelist(Object sender, EventArgs e)
{
Trace.Write("Note - Entered addtosalelist");
string connectionstring= "server=(127.0.0.1);trusted_connection=true;database=LocalHaat.mdf";
SqlConnection dbConnection= new SqlConnection(connectionstring);
dbConnection.Open();
Trace.Write("Note - DB connection set up");

Trace.Write("Note - DB connection opened");

//string commandstring = "INSERT INTO Salelist(sellername, email, address,city,category, itemname, itemdescription,price,paymentmode,negotiable,location) " + "Values(@.sellername, @.email, @.address,@.city,@.category, @.itemname, @.itemdescription,@.price,@.paymentmode,@.negotiable,@.location)";
string commandstring = "INSERT INTO SaleList(SellerName,SellerCity,ItemName) " + "Values(@.SellerName,@.SellerCity,@.ItemName)";
SqlCommand dbcommand= new SqlCommand(commandstring, dbConnection);

SqlParameter sname = new SqlParameter("@.SellerName", SqlDbType.VarChar, 30);
sname.Value = txtname.Text;
dbcommand.Parameters.Add(sname);

SqlParameter scity = new SqlParameter ("@.SellerCity", SqlDbType.VarChar, 15);
scity.Value = city.SelectedItem.Value;
dbcommand.Parameters.Add(scity);

dbcommand.ExecuteNonQuery();
dbConnection.Close();

}

</script>

Error Message
SQL Server does not exist or access denied.
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: SQL Server does not exist or access denied.

Source Error:


Line 11: string connectionstring= "server=(127.0.0.1);trusted_connection=true;database=LocalHaat.mdf";
Line 12: SqlConnection dbConnection= new SqlConnection(connectionstring);
Line 13: dbConnection.Open();
Line 14: Trace.Write("Note - DB connection set up");
Line 15:

Source File: D:\Localhaat\sell.aspx Line: 13

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311
System.Data.SqlClient.SqlConnection.Open() +383
ASP.sell_aspx.addtosalelist(Object sender, EventArgs e) in D:\Localhaat\sell.aspx:13
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1266


------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Request Details
Session Id: satdf0jfaoo3tzjd31vxa355 Request Type: POST
Time of Request: 08/07/2007 19:08:19 Status Code: 500
Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)
Trace Information
Category Message From First(s) From Last(s)
aspx.page Begin Init
aspx.page End Init 0.000044 0.000044
aspx.page Begin LoadViewState 0.000070 0.000026
aspx.page End LoadViewState 0.004889 0.004818
aspx.page Begin ProcessPostData 0.004929 0.000040
aspx.page End ProcessPostData 0.009899 0.004970
aspx.page Begin ProcessPostData Second Try 0.009935 0.000036
aspx.page End ProcessPostData Second Try 0.009972 0.000037
aspx.page Begin Raise ChangedEvents 0.009995 0.000023
aspx.page End Raise ChangedEvents 0.010583 0.000588
aspx.page Begin Raise PostBackEvent 0.010612 0.000029
Note - Entered addtosalelist 0.028321 0.017710
Unhandled Execution Error
SQL Server does not exist or access denied.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at ASP.sell_aspx.addtosalelist(Object sender, EventArgs e) in D:\Localhaat\sell.aspx:line 13
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()

In your connection string there are a few issues

If the sql server instance name is WinCC you should use .\WinCC for the server name

The database name should not enclude the .mdf extension.

string connectionstring= @."server=.\wincc;trusted_connection=true;database=LocalHaat;";

|||

pcg:

string connectionstring= "server=(127.0.0.1);trusted_connection=true;database=LocalHaat.mdf";

At fist change the server attribute from (127.0.0.1) to (local), next use the named instance of the Sql-Server, at last remove the .mdf from the database.

string connectionstring = @."server=(local)\mySqlServer;database=LocalHaat;trusted_connection=true";

Hope that helps.

|||

Hi,

visit this

http://www.connectionstrings.com/http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=395

|||

Thank you very much.

It worked fine.

pcg

|||

Thanks very much for the solution provided.

pcg

database connection

i have database in SQL server .. how can i connect to web page

Please help

many many thanks

Why don't you take a stab at the code and then paste when you have problems.

Search Google for "SQL Server Connect ASP.NET 2.0" and you will get a zillion hits. One of them looks promising.

http://aspnet.4guysfromrolla.com/articles/022206-1.aspx

If you try to do the task and then post a more targeted question, you will likely get better results posting.

Good luck, and do come back with more specific questions.

sql

Database connection

Hi,
Can anyone tell me when to use oleDB, ODBC, SqlConnection and Database
explorer to connect a sql server (from VB.net) where users have windows
security.
ThxHDI
Visit http://www.carlprothman.net/Default.aspx?tabid=81
"HDI" <hdinf@.hotmail.com> wrote in message
news:1168252383.802235.66360@.i15g2000cwa.googlegroups.com...
> Hi,
> Can anyone tell me when to use oleDB, ODBC, SqlConnection and Database
> explorer to connect a sql server (from VB.net) where users have windows
> security.
>
> Thx
>|||Thanx , but this paper explains how to use them not when/ why using
them.
Uri Dimant schreef:
> HDI
> Visit http://www.carlprothman.net/Default.aspx?tabid=81
>
>
> "HDI" <hdinf@.hotmail.com> wrote in message
> news:1168252383.802235.66360@.i15g2000cwa.googlegroups.com...
> > Hi,
> >
> > Can anyone tell me when to use oleDB, ODBC, SqlConnection and Database
> > explorer to connect a sql server (from VB.net) where users have windows
> > security.
> >
> >
> > Thx
> >|||HDI
I thought it was pretty clear if you use VB.NET
"HDI" <hdinf@.hotmail.com> wrote in message
news:1168253291.539504.44540@.38g2000cwa.googlegroups.com...
> Thanx , but this paper explains how to use them not when/ why using
> them.
>
> Uri Dimant schreef:
>> HDI
>> Visit http://www.carlprothman.net/Default.aspx?tabid=81
>>
>>
>> "HDI" <hdinf@.hotmail.com> wrote in message
>> news:1168252383.802235.66360@.i15g2000cwa.googlegroups.com...
>> > Hi,
>> >
>> > Can anyone tell me when to use oleDB, ODBC, SqlConnection and Database
>> > explorer to connect a sql server (from VB.net) where users have windows
>> > security.
>> >
>> >
>> > Thx
>> >
>|||Go for SqlConnection because oleDB and ODBC involve more layers between
the app and SQL Server. See
http://msdn2.microsoft.com/en-us/library/a6cd7c08.aspx for further info.

Database Connection

Hello,

I'm beginner in Ms SQL Server 2005, i dont know how to do a conection to my database.
Using Ms Access, the connection was successful, but using Ms SQL Server 2005 there is a problem.
for information, i try to connect the database using wizard option in ms Frontpage, the problem is, frontpage can only read sys.view file, dbo.view file cannot be able to view.

What is the main procedure or first procedure to create and connect database Ms SQL Server 2005?
I already read a book and internet, but i cant find the solution.

TqHi,

Try to re-install and connect to MS Sql Server 2005 using Windows Authetication. When u install SQL Server it give you some options like using windows Authentication or SQL Server Authentication. So during installation u should select Windows Authentication check box, If u r a single user installing on ur personal computer and practicing. Otherwise u have to set up SQL Server manually and I have no Idea about that.

I hope that helps u

Cheers,

Koonda

Database conn

I have downloaded some code on how to upload images to a sql database and I am getting
this error message

"SQL Server does not exist or access denied.
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: SQL Server does not exist or access denied."

I have opened Enterprise Manager and made sure I was a "user" and everything seems to be ok there.
The connection string looks like this
"server=localhost;uid=sa;pwd=;database=ImageUpload"
Could anyone give me an idea on what to check or try next

Thanksu can try replacing 'localhost' with the ip address
use ipconfig command to know abt ip addr|||What kind of authentication you used? SQL Server authentication or windows integrated?

Try windows integrated authentication.

Database Configuration Problems

I am trying to learn ASP.NET using Visual Basic Standard Edition 2003 and an MSDE database. I am having problems configuring the login. Is this a workable configuration? Are there instructions somewhere for setting up this configuration? I have no problem using Access 2003, but I would like to use MSDE.Hold everything!!! If you're just starting out, then why not learn ASP.NET 2.0 instead? Go to the Home page of this site and follow the 3 steps of "Getting Started with ASP.NET." You get a great free developement tool (Visual Web Developer Express) and download SQL Express 2005 (which replaces MSDE) too (not sure if this is part of the download... if not, google for download... it's free too). That way, you're up-to-date with the latest technology.

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
Bill
You're missing SQL Connections right now!
http://www.sqlconnections.com/shows/...fault.asp?s=59
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||http://www.sqlpass.org/ has an excellent one, or so I hear
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Bill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com/...ston2005Summit
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com/...ston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>
|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
sql

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
Bill
You're missing SQL Connections right now!
http://www.sqlconnections.com/shows/...fault.asp?s=59
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||http://www.sqlpass.org/ has an excellent one, or so I hear
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Bill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com/...ston2005Summit
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com/...ston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>
|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
BillBill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||You're missing SQL Connections right now!
http://www.sqlconnections.com/shows/sql/default.asp?s=59
--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||http://www.sqlpass.org/ has an excellent one, or so I hear :)
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com/view.aspx?source=SQLUReston2005Summit
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com/view.aspx?source=SQLUReston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>> All,
>> I was looking for a database centric developer conference.
>> Any suggestions please ?
>> Thanks in advance.
>> Bill
>>
>|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
Bill
You're missing SQL Connections right now!
http://www.sqlconnections.com/shows/...fault.asp?s=59
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||http://www.sqlpass.org/ has an excellent one, or so I hear
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Bill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com/...ston2005Summit
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com/...ston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>
|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
Bill
You're missing SQL Connections right now!
http://www.sqlconnections.com/shows/...fault.asp?s=59
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||http://www.sqlpass.org/ has an excellent one, or so I hear
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Bill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com/...ston2005Summit
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com/...ston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>
|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>
|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>

Database conference ...

All,
I was looking for a database centric developer conference.
Any suggestions please ?
Thanks in advance.
BillYou're missing SQL Connections right now!
http://www.sqlconnections.com/shows...efault.asp?s=59
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||http://www.sqlpass.org/ has an excellent one, or so I hear
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||Bill,
SQL PASS is always worthwhile. Just hope that SQL2005 is out for this years
conference. Look at http://www.sqlpass.org/
Chris Wood
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||Solid Quality Learning will be holding a Summit in Reston, VA in August. It
will be much smaller than PASS with much deeper, more focussed technical
content. The sessions will build on each other to present a solid
educational experience.
http://www.solidqualitylearning.com...eston2005Summit
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||OHH!! If Kalen says it's good and Solid Quality Learning is behind it, that
would be my recommendation! They are a class act.
Cheers,
Rod
MVP - Windows Server - Clustering
http://www.nw-america.com - Clustering
http://msmvps.com/clustering - Blog
"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:%23u770OmLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> Solid Quality Learning will be holding a Summit in Reston, VA in August.
> It will be much smaller than PASS with much deeper, more focussed
> technical content. The sessions will build on each other to present a
> solid educational experience.
> http://www.solidqualitylearning.com...eston2005Summit
> --
> HTH
> --
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
> "Bill" <bill@.nodomain.com> wrote in message
> news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
>|||Thanks you all for the information.
Have a great day,
Bill
"Bill" <bill@.nodomain.com> wrote in message
news:#A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>|||If you don't want to fly all the way to Las Vegas or Orlando just to brush
shoulders with other SQL developers, you could see if there is a SQL Server
users group meeting in your area. For example: http://www.atlantamdf.com
"Bill" <bill@.nodomain.com> wrote in message
news:%23A2lY$lLFHA.2824@.TK2MSFTNGP10.phx.gbl...
> All,
> I was looking for a database centric developer conference.
> Any suggestions please ?
> Thanks in advance.
> Bill
>sql

Database concurrent access issue

Dear All,

I have this .NET application that inserts lucky draw entries into SQL server. Each entry may have a range of values that the winning number will be drawn from. For example,

Entry 1: [1, 2]
Entry 2: [3, 8]
Entry 3: [9, 10]
Entry 4: [11, 11]
Entry 5: [12, 20]

The winning number will be picked from [1, 20]. Given this scenario, what is the best design that can handle the concurrency issue? If two entries are input at the same time, how to make sure it won't have the same starting value? Anyway to lock a table when one is accessing, disallowing other to run select query?

Thanks.You'll have to explain that better.|||For example, Entry 3: [9, 10] means Entry 3 has the number range starting from 9 and ending at 10.

The winning number will be drawn from the number range.

You'll have to explain that better.|||Clear as mud.

If you want to ensure two entries do not share the same starting value, then make the starting value the primary key or a unique index.|||blindman: qxz wants to validate new entries to ensure that it does not conflict with any existing entry and wants to enforce this validation in case of multiple users updating the Db same time...

qxz: a table lock is needed to ensure proper insert. remember explicit locks can have negative effect on performance

create procedure CheckIt (@.StVal int, @.EndVal int)
as

BEGIN TRANSACTION
declare @.CheckFailed char(1)
set @.CheckFailed = 'N'
if exists (select * from MyTable with (tablockx) where @.StVal between StartVal and EndVal)
set @.CheckFailed = 'Y'
if exists (select * from MyTable where @.EndVal between StartVal and EndVal)
set @.CheckFailed = 'Y'

if @.CheckFailed = 'Y'
begin
ROLLBACK TRANSACTION
return 0
end
else
begin
insert into MyTable .....
COMMIT TRANSACTION
return 1
end

Database concurrency

I'm wondering whether the following code would work if users are RAPIDLY registering (assumption) WITH the same username.
public bool UsernamExists(string username){string sql ="SELECT true FROM [users] WEHRE username = @.username;";return Convert.ToBoolean(comm.ExecuteScalar());}public bool Signup(User user){bool usernameExists = UsernameExists(user.Username);if( usernameExists )return false;//update or insert sql for user etc blah blah}

If two users try to signup AT THE VERY SAME TIME (DOWN TO THE NANOSECOND), would this technique work? Do I have to wrap it in a transaction, stored procedure??


Thanks.

no that does not guarantee unique usernames.

You should add a unique constraint to your username column in the database to guarantee that duplicates cannot exist.

Then, you can still do your usernameexists check it you want, but you would also want to add an error handler (try/catch) to catch the exception that would occur in the unlikely event that two users simultaneously submitted the same usernames.

|||I know about unique column BUT would the technique I mentioned above work IN TERMS OF CODING? Like 2 users submitting AT THE VERY SAME TIME.|||

Yes the code would run, but...

if you dont have a unique constraint in your db, then you could end up with 2 records with the same username.

|||

Your code will not work because you have error in it

"SELECT true FROM [users]WHERE username = @.username;";

you have no comm object defined ad no parameter added to command. But if you update it you will have no guaranty that you will not have two user with the same name in your database. But you can modify you code to do something like this with transaction (safer) or not:

BEGIN TRAN

IF not exist(SELECT * FROM [users]WHERE username = @.username)
BEGIN
INSERT into [users](username)
Values (@.username)
SELECT 'True' [Result]
END
ELSE
SELECT 'False' [RESULT]

COMMIT TRAN

In this way you will save one round trip to SQL server an everything will be done in one shot and very fast.

Thanks


|||

I know you have to use the comm object, excluded it out for the simplicity.

I thought about wrapping my sql syntax in a transaction with row locking, but I'm not to keen on writing that much sql syntax. I like to keep it minimal.

Is there a way the comm object could "perform" the transaction automatically? Can you show me a simple example?

|||

Hi vze1r2ht

There is no way to make the comm object start a transaction automatically. You will need to start a transaction by explicitly calling SqlConnection.BeginTransaction() and assign the returned SqlTransaction object to a SqlCommand.

You can also perform this in a stored procedure by using BEGIN TRAN.

|||

Kevin Yu - MSFT:

Hi vze1r2ht

There is no way to make the comm object start a transaction automatically. You will need to start a transaction by explicitly calling SqlConnection.BeginTransaction() and assign the returned SqlTransaction object to a SqlCommand.

You can also perform this in a stored procedure by using BEGIN TRAN.

Thank you. Is there any major performance hit when using the SqlConnection.BeginTransaction() technique vs SQL's BEGIN Tran? Because of the massive amounts of transactions I will need to write for my classes, it will alll be inline if it was SQL and NOT stored procedures (hard to maintain).

|||

Hi,

As far as I can see, they are the same. Not much differences.