Tuesday, March 27, 2012
Change Image using parameter
What is the best way to load the image into the report?
I have attempted to use a dataset:
I created a logo field in my dataset
I loaded the correct image in VB.NET
I then assigned the 'logo' field in the dataset to this image
My problem is that I don't know what the data type of the logo field should be - I have created the dataset manually and the images are not in a database.
This is my code:
'Load image into ByteArray
Dim fs As New System.IO.FileStream("C:\temp\test.jpg", IO.FileMode.Open)
Dim nBytes As Integer = fs.Length
Dim ByteArray(nBytes) As Byte
Dim nBytesRead As Integer = fs.Read(ByteArray, 0, nBytes)
fs.Read(ByteArray, 0, Convert.ToInt32(fs.Length.ToString(), 10) - 1)
'Set logo field to this image
Dim tbl As New mySchemas.myDataTable
Dim rw As DataRow = tbl.NewRow
rw("logo") = ByteArray 'AN ERROR OCCURS ON THIS LINE
tbl.Rows.Add(rw)
Dim ds As New DataSet
ds.Tables.Add(tbl)
Is this the best way to do load an image into crystal? If so what should the datatype of the logo field be in the dataset? I tried Byte but that did not work.
Thanks for any help
ElaineElaine,
I'll preface this by saying: I don't use CR10, and don't use .NET with CR.
From your code you are declaring a row object to hold the picture.
Shouldn't you be using a "field" object, or whatever the .NET equivalent is?
Field type should be OLE Object/BLOB(BinaryLargeOBject)/BitStream or similar.
Dave|||Thanks for your reply Dave. All sorted now.
The data type I needed turned out to be 'hexbinary'
Incase anyone has the same problem this is the solution:
Dim data As New DataSet()
Dim row As DataRow
data.Tables.Add("Images")
data.Tables(0).Columns.Add("img", System.Type.GetType("System.Byte[]"))
Dim fs As New FileStream("C:\test.jpg", FileMode.Open)
Dim br As New BinaryReader(fs)
row = data.Tables(0).NewRow()
row(0) = br.ReadBytes(br.BaseStream.Length)
data.Tables(0).Rows.Add(row)
br.close
fs.close
br = Nothing
fs = Nothing
' CrystalReport1 is a strongly typed report created in Visual Studio.
Dim cr As New CrystalReport1()
cr.SetDataSource(data)
CrystalReportViewer1.ReportSource = cr|||Are you using the version of crystal reports that came with visual net??
I create the typed dataset with a field hexBinary and load the pictur there but how can I put that picture in the report it shows as a number and no image apearssql
Tuesday, March 20, 2012
change datasource with sqlReportingService2005 class
hi pro , i created model project with .net 2005 after that , create report with reportbuilder that it use this model. it s ok.
i have project and i want to change datasource (connection string ) in runtime when User click on report ,i use sqlReportingService2005 class :
Dim rs As New ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = "Data Source=" & serverName & ";Initial Catalog=" & DataBaseName & ";Integrated Security=True"
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = False ' True
definition.Prompt = Nothing
definition.WindowsCredentials = True ' False
Try
rs.SetDataSourceContents("/Data Sources/" & DataSourceName, definition)
Catch ex As SoapException
Console.WriteLine(ex.Detail.OuterXml)
End Try
End Sub
error "An unhandled exception of type 'System.Net.WebException' occurred in System.Web.Services.dll
Additional information: The request failed with HTTP status 404: Object Not Found." happend
( i checked Enable Unmanged code debugging =true)
please help me
tanks
This error occurs only when the report server URL is given wrong or does not exists. Do check your report server URL assigned to the rs.Url property.
tanks for reply. i was forgotten to say : i have 2 machin ,the first one uses Windows 2003 Server and i installed sql server on it , another machin uses windows a xp and i run project on it( it s like client). when i take project on sql server 2005 it s work nice but when i run project on xp it dosent work.
Are you able to open the report server url in browser?
Change DataSource between Development and Production
them.
Reports created by RS is very impressive, now I need to think about
integration. Two choices for me:
1. URL Access
2. Web Services
Option 1 is the fastest and efficient way, has the followings:
1) DataSource in dev and prod are different, doesn't seem like easy to
change them w/ modifying in the project.
2) SessionID, UserName and Password and other parameters are exposed in
URL unless using SSL, otherwise not secure.
Option 2 needs more coding just like a normal .NET projects but w/o
security concerns, still have to worry about changing DataSource stuff.
For example for .rdl
<DataSourceID>413d324e-1ddf-4c4d-8f2e-2dd50bd8d4ac</DataSourceID>
Our existing .NET has its own web.config file works like a .ini, we put
in all data source connection there, when move to production,
Production Release team needs to change SQL box name, UserID and
password inside of the web.config. Now, how do they change them in
.rdl?
Thanks in advance.Couple of things to consider. First, datasource should be a non-problem if
you use shared datasources (which I recommend). The shared datasource has to
have the same name in both production and dev but that is it. The default
when you deploy is to not overwrite the datasource so once you set it up in
production it will be undisturbed. Second, I suggest using a specific
username and password for retrieving the data from wherever you are getting
it. I create a special readonly user that is used by RS only. This is great
for security since it is readonly and you benefit from connection polling
which you would not if the user account of the user requesting the report is
used. If you report needs to include the user in the where clause (or you
need to use a filter with the username) then user the global variable
User!UserID.
As I said, rdl does not change at all for the datasource.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<hifchan@.yahoo.com> wrote in message
news:1108586517.346073.261520@.c13g2000cwb.googlegroups.com...
> I have some existing .NET app, and so I'd like to integrate the RS w/
> them.
> Reports created by RS is very impressive, now I need to think about
> integration. Two choices for me:
> 1. URL Access
> 2. Web Services
> Option 1 is the fastest and efficient way, has the followings:
> 1) DataSource in dev and prod are different, doesn't seem like easy to
> change them w/ modifying in the project.
> 2) SessionID, UserName and Password and other parameters are exposed in
> URL unless using SSL, otherwise not secure.
> Option 2 needs more coding just like a normal .NET projects but w/o
> security concerns, still have to worry about changing DataSource stuff.
> For example for .rdl
> <DataSourceID>413d324e-1ddf-4c4d-8f2e-2dd50bd8d4ac</DataSourceID>
> Our existing .NET has its own web.config file works like a .ini, we put
> in all data source connection there, when move to production,
> Production Release team needs to change SQL box name, UserID and
> password inside of the web.config. Now, how do they change them in
> .rdl?
> Thanks in advance.
>|||Bruce,
You meant
<DataSourceID>413d324e-1ddf-4c4d-8f2e-2dd50bd8d4ac</DataSourceID> will
not matter as long as the .rdl reference the same <Name> only?|||Yes this is correct. The data source ID is just an internal id used by
report designer only. That is also the reason why the DataSourceID element
is in the report designer namespace: <rd:DataSourceID>. The report server
ignores these ids.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
<hifchan@.yahoo.com> wrote in message
news:1108657866.193950.180150@.g14g2000cwa.googlegroups.com...
> Bruce,
> You meant
> <DataSourceID>413d324e-1ddf-4c4d-8f2e-2dd50bd8d4ac</DataSourceID> will
> not matter as long as the .rdl reference the same <Name> only?
>
Change Datasource abuout url access
We have a ASP.Net app and need a way to manage the datasource.
We have one report for 5 Customer. Every customer has his own DB on our
Server. And Every customer has his own Datasource in the Reportmanager.
Now i call my report with url and will tell the reportservices to take
Connecton 1 or Connection 2 usw.
can i do this with a URL ACCESS ?
UweAbout the only way you could do that now, is with a parameter you pass into
the report...
Still there is a problem... Connections are not dynamic... So you would have
to put Stored procedures or dynamic queries which referred to linked servers
or used openquery, openrowset to move between servers...
SQL 2005 has a dynamic connection capability that will help make this
easier.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Uwe Mielisch" <uwe@.mielisch.de> wrote in message
news:%23UE$dvUiFHA.2916@.TK2MSFTNGP14.phx.gbl...
> Hallo,
> We have a ASP.Net app and need a way to manage the datasource.
> We have one report for 5 Customer. Every customer has his own DB on our
> Server. And Every customer has his own Datasource in the Reportmanager.
> Now i call my report with url and will tell the reportservices to take
> Connecton 1 or Connection 2 usw.
> can i do this with a URL ACCESS ?
> Uwe
>|||Hallo Wayne,
Thank you. What do youn mean with
<parameter you pass into the report...>
Uwe
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> schrieb im Newsbeitrag
news:u1K2jlhiFHA.1412@.TK2MSFTNGP09.phx.gbl...
> About the only way you could do that now, is with a parameter you pass
> into the report...
> Still there is a problem... Connections are not dynamic... So you would
> have to put Stored procedures or dynamic queries which referred to linked
> servers or used openquery, openrowset to move between servers...
> SQL 2005 has a dynamic connection capability that will help make this
> easier.
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Uwe Mielisch" <uwe@.mielisch.de> wrote in message
> news:%23UE$dvUiFHA.2916@.TK2MSFTNGP14.phx.gbl...
>> Hallo,
>> We have a ASP.Net app and need a way to manage the datasource.
>> We have one report for 5 Customer. Every customer has his own DB on our
>> Server. And Every customer has his own Datasource in the Reportmanager.
>> Now i call my report with url and will tell the reportservices to take
>> Connecton 1 or Connection 2 usw.
>> can i do this with a URL ACCESS ?
>> Uwe
>
Thursday, March 8, 2012
change authentication method in a local database file
I have made a small asp.net project which uses a local database file as a part of the project. The project is running fine om my local machine, but when I upload it to the remote server, the login fails for the server.
I suspect this is can be solved by using sqlserver authentication. But I have now spent a lot of time trying to configure the database file to use this authentication mode. As I see it there are three possible solutions to the problem.
- use management studio express to configure the local mdf file (Ecxept that I cant find out how to connect to the mdf-file) and from here change the authentication method to sqlserver authentication. use Visual Web developer to change the authentication method (but how?) make the windows authentication work on the server (this would probably require that mannamgement studio express connects to the remote database. (Same problem as no 1)
Help will be higly appreciated.
Bjarke
hi Bjarke,
to make things run, the account running the application server must be one of the SQL Server registered logins (at the instance level and not database level).. if your solution is hosted, I do think the IT stuff of the hosting company provides that "by default" or nothing would run, and I do not think they will grant you a standard SQL Server login... did you contact them?
regards
|||Hello Andrea!
Maybe I have misunderstood something?
When you make an asp.net 2.0 project there is a folder (App_Data) where sit is possible via Visual web developer to add a sql database file. As I have understood it this file works as a little database server as well. Does SQL server even have to be installed on the server to make these files work as a database?
I have not contacted the hosting company about this problem, because I didnt consider it a problem. But Maybe I am wrong.
Do you know how to change the autnentication method for a local database file? I have tried a lot of things, and searched the internet for an answer, but without luck.
Thanks Bjarke
|||hi Bjarke,
bjarke wrote:
Hello Andrea!
Maybe I have misunderstood something?
When you make an asp.net 2.0 project there is a folder (App_Data) where sit is possible via Visual web developer to add a sql database file. As I have understood it this file works as a little database server as well.
perhaps you are intending User Istances "mode", a feature available only with SQLExpress edition of SQL Server 2005.. remember that this feature is not provided by hoster that do not have SQLExpress but "traditional" SQL Server 2005 editions...
Does SQL server even have to be installed on the server to make these files work as a database?
yes, SQLExpress must be installed on the computer running the application, in your case the web application, thus the application server... when the app start's up, a User Instance of SQLExpress is generated (if not already existing)...
I have not contacted the hosting company about this problem, because I didnt consider it a problem. But Maybe I am wrong.
Do you know how to change the autnentication method for a local database file? I have tried a lot of things, and searched the internet for an answer, but without luck.
Thanks Bjarke
the "traditional" authentication "setting" can be changed using SSMSE, accessing the instance property, in the security tab or modifying a Windows registry key.. stay with the first one
the service must be restarted to use the new settings..
as regard user instances, only Windows authentication can be used with this "access mode"...
if you mean how to modify the authentication settings in the connection strings, you can have a look here..
regards
Wednesday, March 7, 2012
Challenge revisisted
I'm trying to port som old access code to asp.net and the access solution ha
s a couple of queries to sql server that I'm not sure work as expected. I t
hink the idea of the query is to identify if the same event (slaugher of rei
ndeer) is registered in two
different places (field 5 in my last challenge), but two duplicate rows diff
ering only by place does not get selected by the query.
The query is as follows:
SELECT ImportID FROM Temp t WHERE ( EXISTS (
SELECT Year, Code1, Code2, Date FROM (
SELECT DISTINCT Year, Code1, Code2, Date , Place FROM Temp ) SUBQUERY
WHERE ( t.Year = SUBQUERY.Year )
AND ( t.Code1 = SUBQUERY.Code1 )
AND ( t.Code2 = SUBQUERY.Code2 )
AND ( t.Date = SUBQUERY.Date)
GROUP BY Year, Code1, Code2, Date
HAVING (COUNT(*) > 1) ))
Can anyone see if this query does anything useful?, or perhaps give me a que
ry that selects rows with same Year,Code1,Code2,Date, but with different Pla
ce.
The other query is essentially the same, using Zone instead of Place
Morten WennevikOn Mon, 14 Nov 2005 08:51:43 +0100, Morten Wennevik wrote:
>Hi,
>I'm trying to port som old access code to asp.net and the access solution has a cou
ple of queries to sql server that I'm not sure work as expected. I think the idea o
f the query is to identify if the same event (slaugher of reindeer) is registered in
tw
o different places (field 5 in my last challenge), but two duplicate rows differing only by
place does not get selected by the query.
>The query is as follows:
>SELECT ImportID FROM Temp t WHERE ( EXISTS (
> SELECT Year, Code1, Code2, Date FROM (
> SELECT DISTINCT Year, Code1, Code2, Date , Place FROM Temp ) SUBQUERY
> WHERE ( t.Year = SUBQUERY.Year )
> AND ( t.Code1 = SUBQUERY.Code1 )
> AND ( t.Code2 = SUBQUERY.Code2 )
> AND ( t.Date = SUBQUERY.Date)
> GROUP BY Year, Code1, Code2, Date
> HAVING (COUNT(*) > 1) ))
>Can anyone see if this query does anything useful?, or perhaps give me a qu
ery that selects rows with same Year,Code1,Code2,Date, but with different Pl
ace.
>The other query is essentially the same, using Zone instead of Place
>Morten Wennevik
Hi Morten,
I'm not sure what you want eactly. If you want to find year / code1 /
code2 / date combinations for which more than one row exist, use:
SELECT Year, Code1, Code2, Date, COUNT(*)
FROM Temp
GROUP BY Year, Code1, Code2, Date
HAVING COUNT(*) > 1
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Friday, February 24, 2012
CE support from ASP.Net 2.0
MS states that CE does not work with ASP.Net applications 'by default'. What is needed to change this default?
Bascially, my desktop app. is configured from a browser app. (ASP.Net 2.0) and I want to use CE as the datastore for the application.
Thanks.
I don't think this is such a good idea. SQLCe is not designed for this type of application and while it can be adapted for use with ASP.NET, I don't recommend it and (frankly) don't want to encourage you to do so. The information on how to use it on ASP.NET has been published...|||Please explain. What does "SQLCe is not designed for this type of application " mean? No. of connections? Performance?
In my case the web site is the admin. console of an application, so typically the number of users will be low.
Thanks.
|||Steve Lasker described the pros and cons in detail in his bloghttp://blogs.msdn.com/stevelasker/
Basically it can be done - but there are limitations
Brian|||
Thanks for the reference. There still seems to be a gap in the SQL Server lineup. A small embeddable database that supports ODBC. Something like Firebird.
- A
|||Access files (.mdb) can still be used if that is what is needed ...|||Yes, but Access/JET is also not designed for the way that data must be accessed in ASP. Consider that when you're running a site, many "clients" (pages) try to access the database at the same time. While JET is a "multiuser" engine, its file-share architecture funnels all operations on to a single operational thread. This means it works fine in testing and under a light load, but when you site is sucessful, it locks out all but one user at a time. In the case of SQLCe, again only one user is supported at a time but since it's not designed as a multiuser DBMS engine it's not a good choice for a webhosted database. I discuss this in my book. See www.hitchhikerguides.net
|||On a hosted website often one doesn't have a choice over the database. .mdb works fine for me on my relatively low access site.
As OLEDB and SQL Server were not possible then there are few choices.
Perhaps MySQL is another option.
What programming language are you using to access the database? Perl/python/Php?|||Right. The ISPs are often hesitant to install/support a high-maintenance DBMS engine--which is another reason I hesitate to endorse JET.|||
Access is now officially unsupported. That is part of the problem.
- A
|||Strange - just installed Access 2007 ... have you the reference for the non support?No maintenance for Access under 2003 server with .NET2. Correct levels of MDAC come installed. That is why the ISP's let you create a file dsn for ODBC. - not using JET.
From Steve Lasker's blog 27 Nov 2006:
"For many of you, this may sound like the Jet comparison, and it is.
Developers started with Jet, and on their box, everything was fine.
They ran their app, all the commands executed, but they didn’t really
test with different concurrent users. They were able to easily post
the database to their hosting site, and all seemed good. Only after
their app went into production, did they realize they were using a
product that just wasn’t intended for that type of usage. Sure, Jet is
fine for small sites, but did all developers know that when they
started? When they do hit the limitation, what do they do? Re-write
or “upgrade”. "
I have found that for small site usage .mdb is fine. Not every can have a dedictated server or pay the extortionate fees for SQL Server. In my case the upgrade path would be to MySQL - not one I want (or need) to take.|||Hi Bill,
I just bought your ebook on SQL CE, it looks good -- just haven't had time to dig into it yet, but i love the ebook format. I just wanted to point out that we added Connection Pooling and APTC (Allow Partially Trusted Caller) support to VistaDB 3.0 RC1. These are very important features to ASP.NET developers and helps make VistaDB 3.0 an excellent database solution for building small to mid-size ASP.NET applications. So, if you like what SQL CE offers in terms of size and features etc. but want to use it in an ASP.NET application, check out VistaDB 3.0 RC1.
Anthony Carrabino
http://www.vistadb.net/
CE support from ASP.Net 2.0
MS states that CE does not work with ASP.Net applications 'by default'. What is needed to change this default?
Bascially, my desktop app. is configured from a browser app. (ASP.Net 2.0) and I want to use CE as the datastore for the application.
Thanks.
I don't think this is such a good idea. SQLCe is not designed for this type of application and while it can be adapted for use with ASP.NET, I don't recommend it and (frankly) don't want to encourage you to do so. The information on how to use it on ASP.NET has been published...|||Please explain. What does "SQLCe is not designed for this type of application " mean? No. of connections? Performance?
In my case the web site is the admin. console of an application, so typically the number of users will be low.
Thanks.
|||Steve Lasker described the pros and cons in detail in his bloghttp://blogs.msdn.com/stevelasker/
Basically it can be done - but there are limitations
Brian|||
Thanks for the reference. There still seems to be a gap in the SQL Server lineup. A small embeddable database that supports ODBC. Something like Firebird.
- A
|||Access files (.mdb) can still be used if that is what is needed ...|||Yes, but Access/JET is also not designed for the way that data must be accessed in ASP. Consider that when you're running a site, many "clients" (pages) try to access the database at the same time. While JET is a "multiuser" engine, its file-share architecture funnels all operations on to a single operational thread. This means it works fine in testing and under a light load, but when you site is sucessful, it locks out all but one user at a time. In the case of SQLCe, again only one user is supported at a time but since it's not designed as a multiuser DBMS engine it's not a good choice for a webhosted database. I discuss this in my book. See www.hitchhikerguides.net
|||On a hosted website often one doesn't have a choice over the database. .mdb works fine for me on my relatively low access site.
As OLEDB and SQL Server were not possible then there are few choices.
Perhaps MySQL is another option.
What programming language are you using to access the database? Perl/python/Php?|||Right. The ISPs are often hesitant to install/support a high-maintenance DBMS engine--which is another reason I hesitate to endorse JET.|||
Access is now officially unsupported. That is part of the problem.
- A
|||Strange - just installed Access 2007 ... have you the reference for the non support?No maintenance for Access under 2003 server with .NET2. Correct levels of MDAC come installed. That is why the ISP's let you create a file dsn for ODBC. - not using JET.
From Steve Lasker's blog 27 Nov 2006:
"For many of you, this may sound like the Jet comparison, and it is.
Developers started with Jet, and on their box, everything was fine.
They ran their app, all the commands executed, but they didn’t really
test with different concurrent users. They were able to easily post
the database to their hosting site, and all seemed good. Only after
their app went into production, did they realize they were using a
product that just wasn’t intended for that type of usage. Sure, Jet is
fine for small sites, but did all developers know that when they
started? When they do hit the limitation, what do they do? Re-write
or “upgrade”. "
I have found that for small site usage .mdb is fine. Not every can have a dedictated server or pay the extortionate fees for SQL Server. In my case the upgrade path would be to MySQL - not one I want (or need) to take.|||Hi Bill,
I just bought your ebook on SQL CE, it looks good -- just haven't had time to dig into it yet, but i love the ebook format. I just wanted to point out that we added Connection Pooling and APTC (Allow Partially Trusted Caller) support to VistaDB 3.0 RC1. These are very important features to ASP.NET developers and helps make VistaDB 3.0 an excellent database solution for building small to mid-size ASP.NET applications. So, if you like what SQL CE offers in terms of size and features etc. but want to use it in an ASP.NET application, check out VistaDB 3.0 RC1.
Anthony Carrabino
http://www.vistadb.net/
CE Compatibility with ADO.NET and Orcas
Does SQL Server Compact Edition fully support ADO.NET?
Will SQL Server Compact Edition fully support the ADO.NET Entity Framework?
Will SQL Server Compact Edition fully support LINQ?
1. I don't know what you would consider "fully support" but there's special SQL CE ADO.Net managed provider for both desktop and devices. It has pretty much all classes SQL Client has (with few nonessential exceptions) and even something extra (like SqlCeResultSet).
2. Don't know about desktop but there's no EF support on devices. EF on desktop is extensible, even if not supported out of the box support might be available later on.
3. Again, not sure what you mean by that. As name implies LINQ is integrated into programming languages, not into databases. If you’re asking if you’ll be able to query SQL CE database from C# or VB using, say, EF and LINQ then see #2.
Sunday, February 19, 2012
CDOSYS object not working
Windows 2003 server and Sql Server 2000.
I got this code from the net and trying to figure out why it won't work.
It seems to work ok until I do the "send".
I am getting an error:
Source: CDO.Message.1
Description: The transport failed to connect to the server.
Is this the SMTP server or the code that is using the microsoft addresses
(ie. http://schemas.microsoft.com/cdo/co...ation/sendusing)?
My code is:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
Declare @.From varchar(100) , @.To varchar(100) , @.Subject varchar(100), @.Body
varchar(4000)
/ ****************************************
**
This stored procedure takes the parameters and sends an e-mail. All the mail
configurations are hard-coded in the stored procedure. Comments are added to
the stored procedure where necessary. References to the CDOSYS objects are
at the following MSDN Web site:
http://msdn.microsoft.com/library/default.asp?url=/
library/en-us/cdosys/html/_cdosys_messaging.asp
****************************************
***/
Declare @.iMsg int
Declare @.hr int
Declare @.source varchar(255)
Declare @.description varchar(500)
Declare @.output varchar(1000)
Select @.From = 'tfs@.ftsolutions.com',@.To = 'tfs@.ftsolutions.com', @.Subject =
'Backup Notification', @.Body='The Body of the message'
--***** Create the CDO.Message Object *****
EXEC @.hr = sp_OACreate 'CDO.Message', @.iMsg OUT
print '@.hr after Creating CDO.Message'
print @.hr
--*****Configuring the Message Object *****
-- This is to configure a remote SMTP server.
--
http://msdn.microsoft.com/library/d...n_sendusing.asp
EXEC @.hr = sp_OASetProperty @.iMsg, 'Configuration.fields
("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'
print '@.hr after the sendUsing line'
print @.hr
-- This is to configure the Server Name or IP address.
print 'Before the Smtp Server Setup'
-- Replace MailServerName by the name or IP of your SMTP Server.
EXEC @.hr = sp_OASetProperty @.iMsg,
'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpse
rver").Value',
'smtp.earth.com'
print '@.hr After setting up the SMTP server'
print @.hr
-- Save the configurations to the message object.
EXEC @.hr = sp_OAMethod @.iMsg, 'Configuration.Fields.Update', null
print '@.hr after Update'
print @.hr
-- Set the e-mail parameters.
EXEC @.hr = sp_OASetProperty @.iMsg, 'To', @.To
print @.hr
EXEC @.hr = sp_OASetProperty @.iMsg, 'From', @.From
print @.hr
EXEC @.hr = sp_OASetProperty @.iMsg, 'Subject', @.Subject
print @.hr
-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @.hr = sp_OASetProperty @.iMsg, 'TextBody', @.Body
print @.hr
EXEC @.hr = sp_OAMethod @.iMsg, 'Send', NULL
print @.hr
-- Sample error handling.
IF @.hr <>0
select @.hr
BEGIN
EXEC @.hr = sp_OAGetErrorInfo NULL, @.source OUT, @.description OUT
IF @.hr = 0
BEGIN
SELECT @.output = ' Source: ' + @.source
PRINT @.output
SELECT @.output = ' Description: ' + @.description
PRINT @.output
END
ELSE
BEGIN
PRINT ' sp_OAGetErrorInfo failed.'
RETURN
END
END
-- Do some error handling after each step if you have to.
-- Clean up the objects created.
EXEC @.hr = sp_OADestroy @.iMsg
GO
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
All the "print @.hr" lines are all showing 0, except the last one that is
showing: -2147220973.
Thanks,
TomHave you tried using xp_smtp_sendmail instead? I believe it's easier
to use than CDOSYS.
I found these links on Google Groups:
http://www.sqldev.net/xp/sp_smtp_sendmail.htm
http://www.aspfaq.com/2403
HTH
Barry|||"Barry" <barry.oconnor@.manx.net> wrote in message
news:1139940520.616802.88260@.g47g2000cwa.googlegroups.com...
> Have you tried using xp_smtp_sendmail instead? I believe it's easier
> to use than CDOSYS.
I did get it to work if I used the IP address instead of the name address.
I was going to look at sp_smtp_sendmail when Tibor mentioned it. But I did
get CDOSYS working. Is sendmail better?
Thanks,
Tom
> I found these links on Google Groups:
> http://www.sqldev.net/xp/sp_smtp_sendmail.htm
> http://www.aspfaq.com/2403
> HTH
> Barry
>|||Personally, I've never used it. I have read about it and seems quite
good.
I searched Google and I think general opinion is that it's easier to
use and has better scalability.
I guess it's a question of personal preference.
Barry|||I was reading about it also and found that the drawback was that you need an
email client to use it. CDOSYS doesn't need this.|||xp_smtp_sendmail doesn't need an email client. The old x_sendmail does.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"tshad" <tscheiderich@.ftsolutions.com> wrote in message
news:ezp9AvZMGHA.1536@.TK2MSFTNGP11.phx.gbl...
>I was reading about it also and found that the drawback was that you need a
n email client to use
>it. CDOSYS doesn't need this.
>
CD
Can I get: SQL Express with Advanced Services on a CD (or DVD)
I'm on DialUp so a download would take 24hr+.
I was able to get the MS .NET Framework 2.0 on DVD because an MVP took pity on me and was kind enough to give me the "Secret" URL to the correct Order Desk.
I'm hoping one of you knows the URL for this CD/DVD
Roger
Hi Roger,
We're working on CD images for SQL Server Express with Advanced Services in all the languages that SQL Server usually ships in. The English version is in final testing and should be available in a couple of weeks.
Thanks
|||Is this CD available yet ?
Roger
|||Hopefully this will reach Paul Randal
Paul,
Back in May you said you were working on a CD of SQL Server Express with Advanced Services.
Is it available yet?
Roger
CD
Can I get: SQL Express with Advanced Services on a CD (or DVD)
I'm on DialUp so a download would take 24hr+.
I was able to get the MS .NET Framework 2.0 on DVD because an MVP took pity on me and was kind enough to give me the "Secret" URL to the correct Order Desk.
I'm hoping one of you knows the URL for this CD/DVD
Roger
Hi Roger,
We're working on CD images for SQL Server Express with Advanced Services in all the languages that SQL Server usually ships in. The English version is in final testing and should be available in a couple of weeks.
Thanks
|||Is this CD available yet ?
Roger
|||Hopefully this will reach Paul Randal
Paul,
Back in May you said you were working on a CD of SQL Server Express with Advanced Services.
Is it available yet?
Roger
CD
Can I get: SQL Express with Advanced Services on a CD (or DVD)
I'm on DialUp so a download would take 24hr+.
I was able to get the MS .NET Framework 2.0 on DVD because an MVP took pity on me and was kind enough to give me the "Secret" URL to the correct Order Desk.
I'm hoping one of you knows the URL for this CD/DVD
Roger
Hi Roger,
We're working on CD images for SQL Server Express with Advanced Services in all the languages that SQL Server usually ships in. The English version is in final testing and should be available in a couple of weeks.
Thanks
|||Is this CD available yet ?
Roger
|||Hopefully this will reach Paul Randal
Paul,
Back in May you said you were working on a CD of SQL Server Express with Advanced Services.
Is it available yet?
Roger
Thursday, February 16, 2012
Catching report exceptions
have built a custom ASP.NET report interface that launches reports using URL
access. When there is a problem displaying a report, I get the usual
reporting services error, but I would like to redirect to a custom report
page. How do I do that ?
Thanks, Craig"Craig HB" <CraigHB@.discussions.microsoft.com> wrote in message
news:A040A3CA-2A55-4D2A-8410-75E2B353566D@.microsoft.com...
> Instead of using the Report Manager that comes with Reporting Services, I
> have built a custom ASP.NET report interface that launches reports using
> URL
> access. When there is a problem displaying a report, I get the usual
> reporting services error, but I would like to redirect to a custom report
> page. How do I do that ?
> Thanks, Craig
You can use web service Render method to catch an error, but if you want to
use URL approach, than
grab your's url output by using System.Net.HttpWebRequest ( or WebRequest)
class.
If the output is text based (HTML, CSV) - just convert returned by
WebResponse byte array to - char - string and check it for specific error
messages. If the output has to be binary (PDF, EXCEL, etc.) -just check
ContentType of your System.Net.WebResponse class and if it is "text/html" -
the error has occured ( you can always parse byte array to be sure as I
proposed above).