Showing posts with label msdn. Show all posts
Showing posts with label msdn. Show all posts

Monday, March 12, 2012

Number / description of sql error

Hi

All Sql Server errors have a number. Is there any MS or MSDN website or any .net method in which I can see these errors?

Thanks a lot

switch (error.Number)

{

case 17:

msgErro =...

break;

case 4060:

msgErro =...

break;

case 18456:

msgErro = ....

break;

default:

msgErro = exSql.Message;

break;

}

Roberot,

The SQL Server error codes are in SQL Server Books On-line, which is part of the documentation that's installed with SQL Server. You may try googling "SQL Server error codes" if you don't have access to the documentation.

Good luck

|||

Roberot:

Hi

All Sql Server errors have a number. Is there any MS or MSDN website or any .net method in which I can see these errors?

Thanks a lot

switch (error.Number)

{

case 17:

msgErro =...

break;

case 4060:

msgErro =...

break;

case 18456:

msgErro = ....

break;

default:

msgErro = exSql.Message;

break;

}

Try the link below to download the BOL(books online). Hope this helps.

http://www.microsoft.com/downloads/details.aspx?FamilyID=BE6A2C5D-00DF-4220-B133-29C1E0B6585F&displaylang=en

Friday, March 9, 2012

NullReferenceException on an already instanciated object in SQL/C#

Hi, I've posted the following message in the .NET C# MSDN newsgroup, but
there really hasn't been the answer/help that I was expecting. Therefore I a
m
trying the thread here.
--
Hello, I have a perplexing situation. I have the following set of code, whic
h
depends on a scheduling library from GravityBox software (Schedule.NET 2005)
.
Nobody in their forums has been able to help me resolve this problem:
scheduleDomainController1.ConnectionString =
"data source=. \\SQLExpress;database=MyDatabase;Integra
ted Security=True;";
string AccountID = "00000000-0000-0000-0000-000000000000";
try
{
dataSet1 =
scheduleDomainController1.GetScheduleDataSet(AccountID);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
schedule1.DataSource = dataSet1;
schedule1.Bind();
The line above: dataSet1 =
scheduleDomainController1.GetScheduleDataSet(AccountID);
is always raising an exception: NullReferenceException.
"Object reference not set to an instance of an object"
dataSet1 is instanciated/created at runtime as well as
scheduleDomainController1.
I'm miffed here as to why I'm getting this exception. Any clues?
Thanks
MikeI don't know anything about your object, but when using datasets in VB.Net I
often get this same exception. It usually means that either no data was
returned, or there was a database error while retrieving the data.
"eljainc" <eljainc@.discussions.microsoft.com> wrote in message
news:079F346A-ED63-41DC-810B-36B563A6B3C8@.microsoft.com...
> Hi, I've posted the following message in the .NET C# MSDN newsgroup, but
> there really hasn't been the answer/help that I was expecting. Therefore I
am
> trying the thread here.
> --
> Hello, I have a perplexing situation. I have the following set of code,
which
> depends on a scheduling library from GravityBox software (Schedule.NET
2005).
> Nobody in their forums has been able to help me resolve this problem:
> scheduleDomainController1.ConnectionString =
> "data source=. \\SQLExpress;database=MyDatabase;Integra
ted Security=True;";
> string AccountID = "00000000-0000-0000-0000-000000000000";
> try
> {
> dataSet1 =
> scheduleDomainController1.GetScheduleDataSet(AccountID);
> }
> catch (Exception ex)
> {
> MessageBox.Show(ex.Message + ex.StackTrace);
> }
> schedule1.DataSource = dataSet1;
> schedule1.Bind();
>
> The line above: dataSet1 =
> scheduleDomainController1.GetScheduleDataSet(AccountID);
> is always raising an exception: NullReferenceException.
> "Object reference not set to an instance of an object"
> dataSet1 is instanciated/created at runtime as well as
> scheduleDomainController1.
> I'm miffed here as to why I'm getting this exception. Any clues?
> Thanks
> Mike|||Mike,
Can you post the complete stack trace of that exception? That would
help me determine whether the exception is generated from the current
method or from the GetScheduleDataSet method.
Brian
eljainc wrote:
> Hi, I've posted the following message in the .NET C# MSDN newsgroup, but
> there really hasn't been the answer/help that I was expecting. Therefore I
am
> trying the thread here.
> --
> Hello, I have a perplexing situation. I have the following set of code, wh
ich
> depends on a scheduling library from GravityBox software (Schedule.NET 200
5).
> Nobody in their forums has been able to help me resolve this problem:
> scheduleDomainController1.ConnectionString =
> "data source=. \\SQLExpress;database=MyDatabase;Integra
ted Security=True;";
> string AccountID = "00000000-0000-0000-0000-000000000000";
> try
> {
> dataSet1 =
> scheduleDomainController1.GetScheduleDataSet(AccountID);
> }
> catch (Exception ex)
> {
> MessageBox.Show(ex.Message + ex.StackTrace);
> }
> schedule1.DataSource = dataSet1;
> schedule1.Bind();
>
> The line above: dataSet1 =
> scheduleDomainController1.GetScheduleDataSet(AccountID);
> is always raising an exception: NullReferenceException.
> "Object reference not set to an instance of an object"
> dataSet1 is instanciated/created at runtime as well as
> scheduleDomainController1.
> I'm miffed here as to why I'm getting this exception. Any clues?
> Thanks
> Mike|||Is this sceduledomaincont1 an instance?
Juz for test
can you add this before the assignment like this?
dataSet1 = new DataSet();
dataSet1 =
> scheduleDomainController1.GetScheduleDataSet(AccountID);
--