Thursday, March 22, 2012
taking a table out of a page and emailing it
statistics and displayed it on the screen in a Datagrid, and take the table
(datagrid) and put it into an email and send it from that page?
I would also like to read part of a page and print it directly to the
printer.
Thanks,
TomIf you move the logic to a user control, it's a pretty simple thing to do:
http://openmymind.net/FAQ.aspx?documentId=45
Karl
http://www.openmymind.net/
"tshad" <tfs@.dslextreme.com> wrote in message
news:eF2IqikeGHA.1320@.TK2MSFTNGP04.phx.gbl...
> Is there a way to read the current Asp.net page where I may have built
> some
> statistics and displayed it on the screen in a Datagrid, and take the
> table
> (datagrid) and put it into an email and send it from that page?
> I would also like to read part of a page and print it directly to the
> printer.
> Thanks,
> Tom
>
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:e3U%23HTneGHA.2172@.TK2MSFTNGP04.phx.gbl...
> If you move the logic to a user control, it's a pretty simple thing to do:
> http://openmymind.net/FAQ.aspx?documentId=45
Not quite sure if that would do what I am trying to do or not.
There was a way to do this I found a long time ago that allowed me to grab
part of my page and put it into my email to send out, but I can't seem to
find that anymore.
Thanks,
Tom
> Karl
> --
> http://www.openmymind.net/
>
> "tshad" <tfs@.dslextreme.com> wrote in message
> news:eF2IqikeGHA.1320@.TK2MSFTNGP04.phx.gbl...
>
taking a table out of a page and emailing it
statistics and displayed it on the screen in a Datagrid, and take the table
(datagrid) and put it into an email and send it from that page?
I would also like to read part of a page and print it directly to the
printer.
Thanks,
TomIf you move the logic to a user control, it's a pretty simple thing to do:
http://openmymind.net/FAQ.aspx?documentId=45
Karl
--
http://www.openmymind.net/
"tshad" <tfs@.dslextreme.com> wrote in message
news:eF2IqikeGHA.1320@.TK2MSFTNGP04.phx.gbl...
> Is there a way to read the current Asp.net page where I may have built
> some
> statistics and displayed it on the screen in a Datagrid, and take the
> table
> (datagrid) and put it into an email and send it from that page?
> I would also like to read part of a page and print it directly to the
> printer.
> Thanks,
> Tom
"Karl Seguin [MVP]" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:e3U%23HTneGHA.2172@.TK2MSFTNGP04.phx.gbl...
> If you move the logic to a user control, it's a pretty simple thing to do:
> http://openmymind.net/FAQ.aspx?documentId=45
Not quite sure if that would do what I am trying to do or not.
There was a way to do this I found a long time ago that allowed me to grab
part of my page and put it into my email to send out, but I can't seem to
find that anymore.
Thanks,
Tom
> Karl
> --
> http://www.openmymind.net/
>
> "tshad" <tfs@.dslextreme.com> wrote in message
> news:eF2IqikeGHA.1320@.TK2MSFTNGP04.phx.gbl...
>> Is there a way to read the current Asp.net page where I may have built
>> some
>> statistics and displayed it on the screen in a Datagrid, and take the
>> table
>> (datagrid) and put it into an email and send it from that page?
>>
>> I would also like to read part of a page and print it directly to the
>> printer.
>>
>> Thanks,
>>
>> Tom
>>
>>
Tuesday, March 13, 2012
Targeting a database path that is outside of the current project?
Well, good thing that the forum stated "No question too simple" because I'm sure this is uber basic...
I have a working Default.aspx page that accesses a database (hsDatabase.mdf) within the App_Data folder. Just the basic ASP website structure automatically made by Visual Web Developer 2005 Express Edition.
The page works fine on the local computer.
The problem is, when I put it up on my server on the web, the server requires all databases to be put in a specific "database" folder which is up a level from the html folder where I put my ASP and HTML files. That is, it's outside of the project folder.
And try as I might, I can't seem to get the Default.aspx page to connect with database when it's not residing in a folder called "App_Data" which is at the same level as the ASP file.
I assume that the key lies in how I write the connectionstring in the web.config file?
This is the connectionstring that works on my computer:
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hsDatabase.mdf;Integrated Security=True;User Instance=True"
But instead of|DataDirectory|\hsDatabase.mdf, I wish I could just put write a hardcoded address like www.mySite.com/database/hsDatabase.mdf.
Or at least a relative path that worked like../../database/hsDatabase.mdf
How can I connect to a database that's outside of my project folder, or anywhere on the web for that matter?
Thanks everyone!
Hopefully this helps -
Imports System.Data.SqlClientImports System.IOImports System.Web.ConfigurationPartialClass DefaultInherits System.Web.UI.PageProtected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.LoadDim bldrAs New SqlConnectionStringBuilder(WebConfigurationManager.ConnectionStrings("connectionStringName").ConnectionString) bldr.AttachDBFilename = Path.GetFullPath("/otherDir/hsDatabase.mdf")' output modified connection string Response.Write(bldr.ConnectionString &"<hr/>")End SubEnd ClassWell, that's a bit more complicated that I thought it would be! Definitely a change from the old ASP style of doing it.
The outputted modified connection string (bldr.ConnectionString),should I be putting that result into my Default.aspx page or my web.config page? And how do I pass that variable from this .aspx.vb page into the correct page?
BTW... the connection code for the Default.aspx page is: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
while the web.config page is: <connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hsDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Thank you so much again!
Hi robchis,
My suggestion could be wrong,so please correct me if you find any mistakes within my suggestion.Based on my understanding and experience,I think of course you can access the database which is outside of your website root directory. I used to access a sql database which is hosted by another server machine from my website and it works fine. The point is, make sure that the data server has sql-server serverside installed with service correctlly configured and started, then within you website, you can click the "configure Data Source" from you sqldatasource control and input the right sql-server server name and choose the right database.After that you will be able to access the database in your site.
For more and detailed information, please refer to:
http://msdn2.microsoft.com/en-us/library/ms178361.aspx
http://dotnetjunkies.com/QuickStartv20/aspnet/doc/data/databases.aspx