Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

Having Problem in using JDBC Driver for SQL Server 2000 SP3

I'm using jdk 1.5.0 and SQL Server PE,
when i user the driver, it returns
Socket Establishing Failure ...
anyone can help what's the problem is..
Hi
Got the latest SP for JDBC?
http://support.microsoft.com/default...b;en-us;883370
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Stephen Wang" wrote:

> I'm using jdk 1.5.0 and SQL Server PE,
> when i user the driver, it returns
> Socket Establishing Failure ...
> anyone can help what's the problem is..
|||yeah, i got the latest SP3

Having Problem in using JDBC Driver for SQL Server 2000 SP3

I'm using jdk 1.5.0 and SQL Server PE,
when i user the driver, it returns
Socket Establishing Failure ...
anyone can help what's the problem is..Hi
Got the latest SP for JDBC?
http://support.microsoft.com/defaul...kb;en-us;883370
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Stephen Wang" wrote:

> I'm using jdk 1.5.0 and SQL Server PE,
> when i user the driver, it returns
> Socket Establishing Failure ...
> anyone can help what's the problem is..|||yeah, i got the latest SP3

Having Problem in using JDBC Driver for SQL Server 2000 SP3

I'm using jdk 1.5.0 and SQL Server PE,
when i user the driver, it returns
Socket Establishing Failure ...
anyone can help what's the problem is..Hi
Got the latest SP for JDBC?
http://support.microsoft.com/default.aspx?scid=kb;en-us;883370
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Stephen Wang" wrote:
> I'm using jdk 1.5.0 and SQL Server PE,
> when i user the driver, it returns
> Socket Establishing Failure ...
> anyone can help what's the problem is..|||yeah, i got the latest SP3sql

having difficulty inserting into the database table

I created a web form where the user fills in some data and when he submits the form, I do an insert into he database table. The problem is, how can I get the data from the form into the insert statement?. here is the code:
Dim Message As String
Dim connStr As String
Dim myConnection As SqlConnection
Dim mySqlCommand As SqlCommand
connStr = "server=SIMI\VSdotNET;Trusted_Connection=yes;database=AeroSea"
myConnection = New SqlConnection(connStr)
mySqlCommand = New SqlCommand("INSERT INTO TravelRequestEntry (CustomerID,Name) Values (1,name.text)", myConnection)

If I execute the above code, then nothing gets updated. When I change the insert staement into the following,
mySqlCommand = New SqlCommand("INSERT INTO TravelRequestEntry (CustomerID,Name) Values (1,'myname')", myConnection) then,
value 1 for customerID field and myname in the namefield is added.
I know I am doing something stupid, but can't figure it out.
I am confused. please help me.One possibility is this (presuming textbox is name):


mySqlCommand = New SqlCommand("INSERT INTO TravelRequestEntry (CustomerID,Name) Values (1,'" + name.text + "')", myConnection)

Better,use parameters, as the code above is subject to SQL Injection attacks, and as written will fail if the name.Text is "O'Reilly".|||Thanks, I used the parameters and it works fine.

Monday, March 26, 2012

HAving a problem

I am using Windows 2003 server. When iI try to start the sql service using a user account I get an error and cannot start service. When I us a local system account I have no problems. Any ideas on why this is happenning. Thanks.Can you post the error? Are you trying to use domain account,and if yes, - is DC available?

Having 1 user in 2 NT groups causing problems

Hopefully this isnt by design...
I have a user who is a member of 2 NT groups. Both these
groups have access to one of our SQL 2k boxes.
Group A only has access to DB1 as dbo.
Group B only has access to DB2 as dbo.
When this user connects and logs onto DB2 it doesnt work
as it says he doesnt have enough permissions. I'm guessing
its because its only checked Group A?
Short of rejigging our NT groups is there a way round
this? Or have I done something stupid?
SQL Server 2000 sp3a, NT4. User connecting from NT4 client.
Thanks in advance.
Mike.Has Group A been specifically denied any permissions in DB2?
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Mike Watson" <mike@.REMOVE.prog99.com> wrote in message
news:ac7b01c43696$7e46f3f0$a501280a@.phx.gbl...
Hopefully this isnt by design...
I have a user who is a member of 2 NT groups. Both these
groups have access to one of our SQL 2k boxes.
Group A only has access to DB1 as dbo.
Group B only has access to DB2 as dbo.
When this user connects and logs onto DB2 it doesnt work
as it says he doesnt have enough permissions. I'm guessing
its because its only checked Group A?
Short of rejigging our NT groups is there a way round
this? Or have I done something stupid?
SQL Server 2000 sp3a, NT4. User connecting from NT4 client.
Thanks in advance.
Mike.|||>--Original Message--
>Has Group A been specifically denied any permissions in
DB2?
>--
>Tom
Thanks for the swift response Tom. No group A has been
neither denied or granted any access to DB2.
I'm beginning to wonder if group2 has had something
revoked further up the chain somewhere in the domain.|||Does this particular user have any denied permissions in DB2?
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Mike Watson" <mike@.remove.prog99.som> wrote in message
news:a9a001c43699$b28eb690$a401280a@.phx.gbl...
>--Original Message--
>Has Group A been specifically denied any permissions in
DB2?
>--
>Tom
Thanks for the swift response Tom. No group A has been
neither denied or granted any access to DB2.
I'm beginning to wonder if group2 has had something
revoked further up the chain somewhere in the domain.|||
>--Original Message--
>Does this particular user have any denied permissions in
DB2?
>--
>Tom
Nothing immediately jumps out at me. As far as I can see
they are just dbo with no other extra bits.|||What sort of message are you getting?
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
<anonymous@.discussions.microsoft.com> wrote in message
news:ada101c4369c$64a21b40$a001280a@.phx.gbl...

>--Original Message--
>Does this particular user have any denied permissions in
DB2?
>--
>Tom
Nothing immediately jumps out at me. As far as I can see
they are just dbo with no other extra bits.|||
>--Original Message--
>What sort of message are you getting?
>--
>Tom
Unfortunately its going home time here in Scotland and the
weather is surprisingly good so they have gone home. I'll
liase with them tomorrow and see exactly what message they
are getting.|||Glad it worked out. In that case, Group B would not have been able to
access its own database either.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"Mike Watson" <mike@.remove.prog99.com> wrote in message
news:5F75D6D5-76F5-47B3-8858-83FAC6FABFF5@.microsoft.com...
Sorted!
NT group B hadnt been granted access to the NT server. Did that and it all
worked smoothly.
thanks for your assistance.

HAVING (COUNT(category) > 1) , not only 1 row

i am using this code :

SELECT MAX(user) AS lastuser, category
FROM journal
GROUP BY category
HAVING (COUNT(category) > 1)

it works but returns 1 line by category >1

i need all the user (all the rows) HAVING (COUNT(category) > 1) , not only 1

if 1 category has only 1 user i must not keep it

i am not shure to be clear :-)

thank you for helpingIf you need all the users fulfilling the requirements, why are you using the "max" argument. By its nature, the max (maximum) will return the largest value. Get rid of max, add user to your group by and try again.|||you mean

SELECT user, category
FROM journal
GROUP BY user,category
HAVING (COUNT(category) > 1)

i dont get it in that way

I dont need the lines : A|B where count(B) = 1
i need only the lines : A|B. C|B, D|B count(B) > 1

with my first code I get D|B (the last one)|||I don't think that your query will work it would return
where a user had the same category more than once
not differeent categories for the same user.

SELECT user
FROM journal
GROUP BY user
HAVING (COUNT(category) > 1)|||i dont get it in that way
i need for exemple 3 lines

john tennis
pierre tennis
paul tennis

3 lines if count(category) > 1|||SSELECT user_name,
category
FROM journal
WHERE category IN (SELECT category
FROM journal
GROUP BY category
HAVING COUNT(*) > 1)|||i'll try

thank you

Have you heard of DB Ghost?

This is what the last user had say about DB Ghost:
"I consider myself a (demanding) power user and this tool has really grown
on me…maybe it’s because it’s the missing piece of the puzzle to finally take
control over SQL Server database objects using SCC. I have tried a lot of
database compare and synchronize programs and none of them comes close to
creating a single upgrade script as conveniently as DB Ghost. My compliments
on the service."
12 Jan 2005
Janko Lup?a http://www.sicom.si/
http://www.dbghost.com
"mark baekdal" wrote:

> This is what the last user had say about DB Ghost:
> "I consider myself a (demanding) power user and this tool has really grown
> on me…maybe it’s because it’s the missing piece of the puzzle to finally take
> control over SQL Server database objects using SCC. I have tried a lot of
> database compare and synchronize programs and none of them comes close to
> creating a single upgrade script as conveniently as DB Ghost. My compliments
> on the service."
> 12 Jan 2005
> Janko Lup?a http://www.sicom.si/
>
>

Friday, March 23, 2012

Have DTS Package prompt for a file name

I have a user in the IT department that wants a process to take his text file and import it into a SQL Server table. Simple enough with a DTS package.

The rub is that he want's to execute the package and have it prompt him at that point for where the file resides. I tried to get him to go into the DTS pacakge and update the connection, but he doesn't want to do it that way. I suggested renaming the file to a common name to be used each time the application runs, and he wasn't interested in that solution either.

Any help you can give would be greatly appreciated. Thanks!

Have a look at this:

http://www.sqldts.com/default.aspx?226

Wednesday, March 21, 2012

HAS_DBACCESS for any user name

Hi All,
I need function looks like HAS_DBACCESS for any user name.
How can I check has user access to db? As a user or as a member of group.
Thanks.See whether this NG thread helps.
http://tinyurl.com/88jl2
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com
"Oleg Cherkasenko" <oleg@.opel.com.ua> wrote in message
news:OMIZzsHrFHA.528@.TK2MSFTNGP09.phx.gbl...
> Hi All,
> I need function looks like HAS_DBACCESS for any user name.
> How can I check has user access to db? As a user or as a member of group.
> Thanks.
>
>|||Thanksm its useful.
The hard case is:
I have a windows user 'user1' which is a member of windows group 'group1'.
In SQL Server I added this group 'group1' only but not 'user1'.
'user1' has a db access via memebership in 'group1', but I cannot find this
user name in sql server tables and procedures.
Its a question.
Regards.
"Roji. P. Thomas" <thomasroji@.gmail.com> wrote in message
news:evwZvzHrFHA.908@.tk2msftngp13.phx.gbl...
> See whether this NG thread helps.
> http://tinyurl.com/88jl2
> --
> Roji. P. Thomas

> Net Asset Management
> http://toponewithties.blogspot.com
>
> "Oleg Cherkasenko" <oleg@.opel.com.ua> wrote in message
> news:OMIZzsHrFHA.528@.TK2MSFTNGP09.phx.gbl...
>sql

Wednesday, March 7, 2012

Hard Drive Crashed. master & user db mdf & ldf files lost

Hello.

One of our hard drives has crashed and as a result we have lost our master mdf/ldf & user db mdf/ldf files. It's not that a critical system by any means, but if the hard drive crashes and the master mdf/ldf files & user db mdf/ldf are lost, is there any way of restoring the system?

I'm thinking we probably need to re-install Enterprise Manager completely, and re-install the user db from a backup.

Any advice/suggestions would be much appreciated.

Thanks in advance,If the disks are toast, then you have to restore from your backups. When you have the hardware and O/S back to where they need to be, install SQL Server with any required service packs/patches, then restore the master database (see BOL for instructions), then restore the user databases.

Hard Coded parameters

Is it possible to force parameters into the reports so enabling me to force a user id value into every report that is picked up from the list. The user ID is a system value and I don't want end users having any knowledge of it?

Cheers

Darren

Hello Darren,

What you can do is create a hidden/internal parameter so that the end user can not see it. From BOL:

Hidden

Select this option if the parameter value should not appear on the report. Although hidden parameters do not appear on a report, they can be set in other ways (for example, in subscriptions and through URLs).

Internal

Select this option if the parameter cannot be changed at run time. On a published report, no visual evidence is provided to indicate that this parameter exists.

Hope this helps.

Jarret

|||

Hi Jarret,

I think this may be the answer, I need to provide a list of published reports , how would we then get the hidden parameter into it.

Can we display a URL with the user ID already in it which will then render the report viewer with the other optional parameters to be picked. How do we stop somebody constructing a URL with a different user ID.

A hidden parameter sounds like the right option but I'm confused how to populate it.

Cheers, Darren

|||

If you're wanting to keep it out of the URL as well, you'll need to go with an Internal parameter, since it can not be changed at run time. Hidden parameters can be changed through the URL. You can change the value of this from within your Report Manager. Go to the properties of your report, then go into the Parameters section. In there, you can change the default value to whatever you like.

Hope this helps.

Jarret

|||Is the Internal parameter fixed in the report then? I want to be able to change the value based on the user running the report but do not want them to be able to change to a user ID not associated to them.|||

I'm not sure how you were planning to change the user ID of the user running the report, but you can set an expression for the default value of any parameter through VS.

If you put =User!UserID as the Default value for your parameter, it will show the domain account used.

Just remember, if you use a hidden parameter, someone can manipulate the value via the URL. This is not possible with an internal parameter.

Jarret

|||

Thanks Jarret,

I think I know what we will do know. The web site maintains a guid session token for each user which originates from the database initially so if I use this as my hidden parameter and let the reports stored procedure calculate the user ID based on this I will be safe.

Cheers

|||

That sounds like it would work, but someone can pass in that parameter via the URL since you're using a hidden parameter. The internal parameter should work in this situation too, and you don't have to worry about it being changed by a user.

Anyway, I'm glad you have a solution. Can you mark this one as answered so others can see the solution?

Jarret

Monday, February 27, 2012

Handling wildcard characters in query string

Hi

First interaction to the forum.
My Query is :

I had a User Management module in my application where I created a user with name

`~!@.#$@.%^&*()[_]+|}{":?><-=\[[]];',./

Now I have a functionality to search for the user existing. For that give the search string or a single character and it finds out all the records containing the character.

How do I go about it as the SP i created for it gives correct results except the following

1. Search for % - Gives all record
2. Search for _ - Gives all records
3. Search for [ - Gives NO record
4. Search for the whole string - Gives NO Record

I handeled a few issues

1. replaced [ by [[]
2. replaced _ by [_]

So issues 2 & 3 are resolved.

Tried replacing % by [%] but did not work

Could someone plz help

Thanks in advance
AshutoshYou could search the string with CHARINDEX function instead of using LIKE.

HTH|||You could search the string with CHARINDEX function instead of using LIKE.

HTH

Sorry but did not get your point as how this will help me get through

Ashutosh|||What is your current where predicate?|||What is your current where predicate?

WHERE FName like '%`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./%'

In the front end code I handle it as input params come with %...% qualifiers and ' is replaced by ''

On the sql side i replace _ by [_] and [ by [[]

Ashutosh|||Why use LIKE? Is there a reason you can't search for the literal value?

WHERE FName = '`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./'
Otherwise, if you are searching for a string portion, use charindex
WHERE CHARINDEX('`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./', FName) >0
HTH

EDIT - you would need to remove the code adding the extra square brackets as you are searching for literals now.|||Why use LIKE? Is there a reason you can't search for the literal value?

WHERE FName = '`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./'
Otherwise, if you are searching for a string portion, use charindex
WHERE CHARINDEX('`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./', FName) >0
HTH

EDIT - you would need to remove the code adding the extra square brackets as you are searching for literals now.

well i am pretty much reluctant to change the sp and UDF for that

if i could somehow get around it just by some sort of replace statement etc, that would be nice :)

Ashutosh|||well i am pretty much reluctant to change the sp and UDF for that

if i could somehow get around it just by some sort of replace statement etc, that would be nice :)


AshutoshThere's another reason - sargability. LIKE '%something%' isn't an efficient search if you are looking for the exact string match rather than a portion. It appears that you are looking for one bodge to correct for another.|||There's another reason - sargability. LIKE '%something%' isn't an efficient search if you are looking for the exact string match rather than a portion. It appears that you are looking for one bodge to correct for another.

Probably i have gone the harder way

I created the function to check the same. If there is an exact match, it passes the parameter as string only else it pads the % characters into it

Ashutosh|||well i am pretty much reluctant to change the sp and UDF for that

if i could somehow get around it just by some sort of replace statement etc, that would be nice :)


AshutoshIf you aren't keen on CHARINDEX and you need to search for portions then perhaps:

WHERE REPLACE(REPLACE(FName, '%', 'Wild1'), '_', 'Wild2') LIKE REPLACE(REPLACE('`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./', '%', 'Wild1'), '_', 'Wild2')
It ain't exactly pretty though.|||If you aren't keen on CHARINDEX and you need to search for portions then perhaps:

WHERE REPLACE(REPLACE(FName, '%', 'Wild1'), '_', 'Wild2') LIKE REPLACE(REPLACE('`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./', '%', 'Wild1'), '_', 'Wild2')
It ain't exactly pretty though.

I di the same but in that case it also replaces the leading and trailing % which I have from the code itself and hense the criteria changes.

%%% --> should come as %[%]%

but it comes as [%][%][%]

Ashutosh|||This is an SP yes? So '%`~!@.#$%^&*()[_]+|}{":?><-=\[[]];'',./%' is actually passed as a parameter - like @.myParam?

Handling Languages in Reports

Hello,
I have a French and English user base and I would like to display reports in
the language of preference of the user. However, I am not certain as to a
best practice for this within VStudio. In addition, how can I make the
reportserver display a french GUI?
Any help would be apprecaited,
--
RyanHi Ryan,
My understanding of this issue is: You want to show different layout based
on different language in reporting services. If I misunderstood your
concern, please feel free to let me know.
You can use the locale settings on a client computer to determine how a
report appears to the user. For example, you can create a report that uses
a different query expression based on the locale information returned by
the User.Language global variable. The query may change to retrieve
localized information from a different column depending on the language
returned. You can also use an expression in the language settings of the
report or report items based on this variable.
While you can change the language settings of a report, you must be careful
about any display issues this may cause. For example, changing the locale
setting of the report can change the date format in the report, but it can
also change the currency format. Unless there is a conversion process in
place for the currency, this may cause the incorrect currency symbol to be
displayed in the report. To avoid this, set the language information on the
individual items that you want to change, or set the item with the currency
data to a specific language.
Here is a BOL article for your reference:
International Considerations for Reporting Services
http://msdn2.microsoft.com/en-us/library/ms156493(d=ide).aspx
Hope this will be helpful!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Thank-you Wei,
I will have a look at that and I may have a follow-up question for you at a
later date.
--
Ryan
"Wei Lu [MSFT]" wrote:
> Hi Ryan,
> My understanding of this issue is: You want to show different layout based
> on different language in reporting services. If I misunderstood your
> concern, please feel free to let me know.
> You can use the locale settings on a client computer to determine how a
> report appears to the user. For example, you can create a report that uses
> a different query expression based on the locale information returned by
> the User.Language global variable. The query may change to retrieve
> localized information from a different column depending on the language
> returned. You can also use an expression in the language settings of the
> report or report items based on this variable.
> While you can change the language settings of a report, you must be careful
> about any display issues this may cause. For example, changing the locale
> setting of the report can change the date format in the report, but it can
> also change the currency format. Unless there is a conversion process in
> place for the currency, this may cause the incorrect currency symbol to be
> displayed in the report. To avoid this, set the language information on the
> individual items that you want to change, or set the item with the currency
> data to a specific language.
> Here is a BOL article for your reference:
> International Considerations for Reporting Services
> http://msdn2.microsoft.com/en-us/library/ms156493(d=ide).aspx
> Hope this will be helpful!
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ==================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Hi Ryan,
Thank you for your update.
I will close this issue now and if you have any questions about this issue,
please feel free to re-enter the newsgroup and post it under this thread. I
will reply as soon as possible.
Have a nice day!
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Handling errors returned by SSRS

We are displaying the report in our reporting application but we do not want to display errors from SSRS to the user. We want to handle the errors and display a user friendly message.

How can that be done?. We are making URL access to the report server.

Thanks.

Please help me to understand this better. If you use URL addressability what application layer will handle the error messages? If you use the VS.NET 2005 Report Viewer control, your application can handle the ReportError event.|||

Alright,

So we are using an iframe in our application which we are making a url call to the report server. Hence, if there is a problem like "access" denied, we do not want the iframe to read "SQL Server error" but have some error that shows that the user is interacting with our application. This can only be done if on the report server we could write some generic error page which will always get called anytime ssrs throws an error.

Thanks.

|||Sorry, you are out of lack here. URL addressability is certainly very easy but not that flexible. Same limitations apply as invoking a server-side web page by URL.|||

Hi,

I have my report viewer control and reporterror event to handel all the exception.Do we need to call the reporterror event in my code or automatically it will be called when error occurs?

Thanks,

Ranjan

|||Not sure what you mean by call the event. The event handler will be called for you when the event happens (in this case the report errors out).|||

Hi Teo,

If u have any sample code of how to show a report in reportviewer along with reporterror event and if you can post it here it would be very helpful.

Thanks,

Ranjan

|||

private void reportViewer1_ReportError(object sender, Microsoft.Reporting.WinForms.ReportErrorEventArgs e)

{

// use e.Exception to get to the exception

// set e.Handled to true to prevent the ReportViewer from displaying an error message.

}

More about ReportViewer in this article.

Handling errors returned by SSRS

We are displaying the report in our reporting application but we do not want to display errors from SSRS to the user. We want to handle the errors and display a user friendly message.

How can that be done?. We are making URL access to the report server.

Thanks.

Please help me to understand this better. If you use URL addressability what application layer will handle the error messages? If you use the VS.NET 2005 Report Viewer control, your application can handle the ReportError event.|||

Alright,

So we are using an iframe in our application which we are making a url call to the report server. Hence, if there is a problem like "access" denied, we do not want the iframe to read "SQL Server error" but have some error that shows that the user is interacting with our application. This can only be done if on the report server we could write some generic error page which will always get called anytime ssrs throws an error.

Thanks.

|||Sorry, you are out of lack here. URL addressability is certainly very easy but not that flexible. Same limitations apply as invoking a server-side web page by URL.|||

Hi,

I have my report viewer control and reporterror event to handel all the exception.Do we need to call the reporterror event in my code or automatically it will be called when error occurs?

Thanks,

Ranjan

|||Not sure what you mean by call the event. The event handler will be called for you when the event happens (in this case the report errors out).|||

Hi Teo,

If u have any sample code of how to show a report in reportviewer along with reporterror event and if you can post it here it would be very helpful.

Thanks,

Ranjan

|||

private void reportViewer1_ReportError(object sender, Microsoft.Reporting.WinForms.ReportErrorEventArgs e)

{

// use e.Exception to get to the exception

// set e.Handled to true to prevent the ReportViewer from displaying an error message.

}

More about ReportViewer in this article.

Friday, February 24, 2012

Handling a SQL Exceptions and Custom Error Messages

Hello guys,

I need some ideas on how to handle an exception or a user defined error message.

I have a procedure that creates a new user. Lets say if the e-mail address entered is already in use. What are some of the best practices for notifying the user that the e-mail address is already in use?

This is what I was thinking...

Solution #1
-----
My proc will raise an error with a message id that is great than 50000, then my DAL will recognize this is a user defined error and spit back to the user instead of trapping it.

Solution #2
-----
The proc should have an output param ( @.CreationStatus CHAR(1) ).
If the @.CreationStatus has a value for example "E", I will have lookup the value for "E" in my app and spit back that custom error message. I don't really like this option because it is too concrete.

What are some of the ways you deal with this situation?

Your suggestions are greatly appreciated.

Thank you!

You could return a @.status value with (0=success, 1= failure and an appropriate status message @.Statusmsg ( = 'Success' if @.status = 0, custom error message if @.status = 1)

From your application you could check the value in @.status and if its not 0, then display the message from @.statusmsg. You can handle this in a number of ways, It comes down to setting up one standard way of doing it across all procs and communicating with your team and documenting it so the same logic is followed across all procs.

Sunday, February 19, 2012

Hacked SQL Server

We just found out that we got hacked by the sql server
worm. We have updated the machine and removed the worm.
However we now have a new user in our sql database that
we did not have before. Also we can no longer access any
of the databases that we were able to before. Looks like
the hacker accessed the sa account and changed the
password. Whenever we try to do anything we get a message
saying we do not have access. Looks like the hacker
removed administrators from doing any changes to the
machine.
How do we recover the sa account password or make any
changes to anything?
Thanks in advance for any advice
David Anderson
andretti@.toyorders.comWas the SQL Server behind a firewall?
What service pack were you running on SQL?
Do you have backups of the master database prior to this event?
The only options are restoring master or using rebuildm to rebuilt the
master database.
But, unless you understand how the machine was comprimised, this may happen
again.
Our recommendation & the general recommendation of the Security community
would be to rebuild the machine from the OS with all the patches installed.
However, you will need to make a business decision and weigh out the pros
and cons of not be able to conclusively detect all the changes made to this
machine. Cert also has good recommendations;
http://www.cert.org/nav/recovering.html
Help: I Got Hacked. Now What Do I Do?
http://www.microsoft.com/technet/co...gmt/sm0504.mspx
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||On Tue, 15 Jun 2004 15:02:50 -0700, "David Anderson"
<andretti@.toyorders.com> wrote:

>We just found out that we got hacked by the sql server
>worm. We have updated the machine and removed the worm.
>However we now have a new user in our sql database that
>we did not have before. Also we can no longer access any
>of the databases that we were able to before. Looks like
>the hacker accessed the sa account and changed the
>password. Whenever we try to do anything we get a message
>saying we do not have access. Looks like the hacker
>removed administrators from doing any changes to the
>machine.
>How do we recover the sa account password or make any
>changes to anything?
You can restore the Master DB from backup or rebuild it to recover the
SA settings or reset them to defaults. Be aware there may have been
changes since your last valid backup that may affect your database.
Also, are you sure that you're not still compromised? Having SA
access, especially if the SP_EXEC stored procedure is left in place
means you could have much more compromised on your system than your
SQL server accounts.
Best is to nuke and rebuild. Only restore from known good backups.
Jeff