Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Friday, March 30, 2012

is it possible to put the raiseerror in a text file or show it to the user after its been

I am in process of building a website where the user can upload files and then those files are loaded in to a sql server database. I am using some sprocs to scrub the data and then insert them into the production database.. And in my sprpc before and after updating or inserting a record or scrubing... i am returning the count by raising an error. or returning the rownumber where the error occured.. is there any way i can get the raise error part or whatever error i get while scrubing the data and relay it back to the user in a user freindly way or in a text file... or the best thing is can i open smalll window where i can show them what processing is goin on and alert them if there are any errors...

Any help will be appreciated.

Regards

Karen

Take a look forSqlException.Errors. Any SqlError object has the number of error and another informations.

PS.: To another databases, take a look forOleDbException.Errors.

|||

Hi Karenros,

Based on my understanding, you want to use Raiserror to generate an error message and pass it to the client user. Client user may get an alerting message or write it to a text file when getting the error message. If I've misunderstood you ,please feel free to tell me, thanks.

You can put your sqlcommand in a try block and in your catch block, write sqlconnection.errors.message to a text file. Please remember do not assign the severity value of your error message more than 19, or else it maybe cause terminate your connection. Sample code is like the following:

 try { con.Open(); cmd.ExecuteNonQuery(); }catch (SqlException ex) {using(StreamWriter sw=new StreamWriter("your text log file path here")) {foreach (SqlError errin ex.Errors) sw.WriteLine(err.Message+"\n"); } }
Hope my suggestion helps
|||

Chen,

Thanks for your answer. yeah and thats exactly that i wanted to do... so that user would know if the import process was successful or not...

I have tried using sqlexception before with no luck.. may be i didnt import the right header files in order for that work and i have also seen on msdn that we need a sqlinfomessage class or something like to do it.. Pls correct me if i am wrong...

anyways i am gonna give it a try and will let you know...

Regards

Karen

|||

Below is an example of how you can use the InfoMessage event handler:

First you'll have to create an event handler for this event like below:

con.Open();
con.InfoMessage +=new SqlInfoMessageEventHandler(con_InfoMessage);// here i've registered for the event
... set up the command object
cmd.NotificationAutoEnlist =true;
cmd.ExecuteNonQuery();

Then you can go on and write any code you want in that event handler method.

private void con_InfoMessage(object sender, SqlInfoMessageEventArgs e)
{
// your file writing code goes here. The eventArgs e holds errors, messages, source etc.
// you can just use e.ToString() and everything is there for you.
}

Hope this will help.

|||

Hi Karenros,

I've tested the sqlexception code on my local machine and it does work fine. So, maybe you have made some mistakes somewhere else.

However, I think you can also trydhimant 's solution. That's really a good method to solve your problem. thanks

Wednesday, March 28, 2012

Is it possible to launch a report rendered in excel or pdf instead of report viewer?

On my reporting services website, I would like to browse to a report,
click on it and have it render to excel or pdf by instead of report
viewer. Is this possible? I know that I can create rs scripts that run
a report and render to excel, but would like to users to experience
this on the web if possible. I couldn't find this option.you can try to send the format you want in the URL:
http://localhost/......&rs:Format=Excel
"steve" <stevensherman@.comcast.net> wrote in message
news:1165705966.309429.275880@.16g2000cwy.googlegroups.com...
> On my reporting services website, I would like to browse to a report,
> click on it and have it render to excel or pdf by instead of report
> viewer. Is this possible? I know that I can create rs scripts that run
> a report and render to excel, but would like to users to experience
> this on the web if possible. I couldn't find this option.
>|||Putting the format in the url works nicely. Thanks for the reply - that
helps. I was hoping that the report manager would have a configuration
setting for a report that would indicate how to render it.
Jeje wrote:
> you can try to send the format you want in the URL:
> http://localhost/......&rs:Format=Excel
>
> "steve" <stevensherman@.comcast.net> wrote in message
> news:1165705966.309429.275880@.16g2000cwy.googlegroups.com...
> > On my reporting services website, I would like to browse to a report,
> > click on it and have it render to excel or pdf by instead of report
> > viewer. Is this possible? I know that I can create rs scripts that run
> > a report and render to excel, but would like to users to experience
> > this on the web if possible. I couldn't find this option.
> >|||I'm not sure, maybe you'll found in the config files of your reporting
services installation the default rendering format.
I'm sure there is a list of authorized formats, so I presume there is a
default rendering option.
"steve" <stevensherman@.comcast.net> wrote in message
news:1165768599.615241.90010@.j44g2000cwa.googlegroups.com...
> Putting the format in the url works nicely. Thanks for the reply - that
> helps. I was hoping that the report manager would have a configuration
> setting for a report that would indicate how to render it.
>
> Jeje wrote:
>> you can try to send the format you want in the URL:
>> http://localhost/......&rs:Format=Excel
>>
>> "steve" <stevensherman@.comcast.net> wrote in message
>> news:1165705966.309429.275880@.16g2000cwy.googlegroups.com...
>> > On my reporting services website, I would like to browse to a report,
>> > click on it and have it render to excel or pdf by instead of report
>> > viewer. Is this possible? I know that I can create rs scripts that run
>> > a report and render to excel, but would like to users to experience
>> > this on the web if possible. I couldn't find this option.
>> >
>|||Report manager is not configurable that way. You have to create your own
portal if you want to do that. I recommend against doing this. HTML is much
much faster and having all your reports default to PDF is just not a good
idea.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"steve" <stevensherman@.comcast.net> wrote in message
news:1165768599.615241.90010@.j44g2000cwa.googlegroups.com...
> Putting the format in the url works nicely. Thanks for the reply - that
> helps. I was hoping that the report manager would have a configuration
> setting for a report that would indicate how to render it.
>
> Jeje wrote:
>> you can try to send the format you want in the URL:
>> http://localhost/......&rs:Format=Excel
>>
>> "steve" <stevensherman@.comcast.net> wrote in message
>> news:1165705966.309429.275880@.16g2000cwy.googlegroups.com...
>> > On my reporting services website, I would like to browse to a report,
>> > click on it and have it render to excel or pdf by instead of report
>> > viewer. Is this possible? I know that I can create rs scripts that run
>> > a report and render to excel, but would like to users to experience
>> > this on the web if possible. I couldn't find this option.
>> >
>sql

Monday, March 26, 2012

Is it possible to have a website remotely hosted, which would access local database?

Hi everybody,

Currently we have a MIS application, developed in VB 6.0 - SQL Server 2000 platform, which is used by around 60 users in our office.

We are planning to host a website remotely, which would allow clients to place orders, track order status etc. on it.

Would it be possible to access our local SQL database from the remote website?

utpal_nandi:

Would it be possible to access our local SQL database from the remote website?

I'm afraid, it won't be possible. You should host the database also.

|||

Well I guess in theory that's not impossible. It might be impracticle though...

When you say "our local SQL database", is that hosted on a dedicated box? You could open that up for remote (read: internet) connections. That would allow your web server to access it.

However, that probably won't save you any time and will deprive you of an in house server that could be used for testing, etc. Also, it'll probably be slower for the webserver to query your sql server over the internet than it would be to query another server on its own network (if you hosted the database at the same place you host the website).

So you asked if it would be possible, and the answer is yes, but I wouldn't actually recommend it.

|||

What do you mean by "dedicated box"? Do you mean dedicated server? We will be having a dedicated server on Windows 2000 Datacenter edition on which the database as well as the web server (IIS) would be installed. The web server would be opened up for remote connections through a static IP.

Regarding the time factor, 90% of our data entry and database access would be done by our office staff on our local database, which would be faster than doing the same on a remote database. Moreover in case of a remote database, if our internet connection fails, our work would get held up. Only 10% of data entry and database access would be done by our clients in case of a local database, which would be slow and could be alternatively done by our local staff in case the internet connection fails.

|||

Hi,

Regarding the time factor, 90% of our data entry and database access would be done by our office staff on our local database, which would be faster than doing the same on a remote database.

From your description, I think that you can make your MIS system connect to the local database first, and then update the data to the live server in a schedule plan. To achieve this, one of the ways is to create a step job in SQLServer Agent, and make your remote database be synchronized with your local database server.

Besides, if you are using Visual Studio Team Suite, you can start a Database project, in that project, you can deploy your local database to your remote server in an easy way, meantime, schema comparison and data comparison between databases on different servers are enabled, you can make different databases be synchronized more easier than before.

Thanks.

Monday, March 12, 2012

Is it Possible ?

Creating website in C# using Visual Studio 2005

Hi want to have something done, just to make sure if a such a thing can be done or not. I have a table in the Sql server 2005 called users. This contains all the users with usernames and passwords.

Now have another table called absent. In it there are 3 fields ID (autonumber),Username and Date.

Say if a user is absent. it will check the table user for their respected username, next it will go to another table called attendance in which consists of the username date, time in and timeout.

If the user has not signed in for today at 3pm in the afternoon then it should save the details in the absent table.

--------------

User table has user - Kevin

Now if kevin does notsign in the webform, after 3pm in the afternoon, the sql server must save the entry kevin with the date in the absent column.

The part in bold basically means to check if the user details are present for todays date in another table called Attendance for that user

Similarly if there are other users then same steps

--------------

I hope i clarified it

Thanks for your help

Sheldon

Create a job in SqlServer Agent, set up runtime at 3:00 PM every day. The job updates the tables based on your conditions.

|||Hi again thanks but you could post some more help or some links which deals with this|||

1). create a SP to carry out your task -- Update tables

2). In SqlServer Management-Jobs, create a job to execute this SP

Here is a reference that show you how to create a job.http://www.quackit.com/sql_server/tutorial/sql_server_agent_jobs.cfm

Google SqlServer Agent Jobs for help.

Friday, February 24, 2012

is folder App_data uses to store database by .net 2.0 hosting companies?

I am workin on a website for me and my friend. I want to host it at a hosting company. In asp.net 2.0 projects are build with the App_data folder, which can stores data source such as a SQL Server 2005 database. But when i want to host the site at a hosting company, will the database goed into this folder?

I also have a hosting company and dealing with the same problem.

The company has a SQL server that is different than the web server so; you have to create the database in the SQL server and then have your asp codes connect to that server by a connection string. You have to have the IP address of the server, your username and password to make that work.

Hope this helps.Smile

Is Enterprize manager secure for remote admin?

Hello all,

An ASP.NET website hosting service allows the use of Enterprize Manager to manage the backend database of a hosted asp.net website. This is not done across a VPN and I don't think it could be done on SSL so the question is : How Secure is that? would this be ok for learning but not Ecommerce? Or is it an encrypted session and I paranoid?

-Thanks
HeywadeI wouldn't be overly enthusiastic about storing sensitive e-commerce info in there, no. I think you can rig it to communicate with IPSec, but it depends what the host supports - ask them.