|
Hello,
VS 2005 SQL 2005
I would like to change the connection string dynamcially during program run-time. But get the code to work. There is no run-time errors and the code compiles ok. However, the code does not let me get the connection string, and I would like to update the connection string at run-time.
This is my code in the web.config file.
<br />
<connectionStrings><br />
<add name="ServiceMasterConnectionString" <br />
connectionString ="data source=dev01; initial catalog = serviceMaster; user id=; pwd="<br />
providerName="System.Data.SqlClient"/><br />
</connectionStrings><br />
The code in my website that is used to retrieve the website is as follows:
<br />
imports system.configuration.configuration<br />
<br />
Dim rootWebConfig As System.Configuration.Configuration<br />
rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/Incidents/")<br />
Dim connString As System.Configuration.ConnectionStringSettings<br />
connString = rootWebConfig.ConnectionStrings.ConnectionStrings("ServiceMasterConnectionString")<br />
incidents is the folder that contains the web.config file. That has a virtual path in the IIS.
Can anyone correct if I have done anything wrong in the code above,
Many thanks in advance,
Steve
|
|
|
|
|
You might want to reconsider placing the configuration information in another database or XML File rather than the web.config.
Also when you change web.config, the application resets and will want to recompile.
|
|
|
|
|
<connectionStrings>
<add name="MyConnString" connectionString="Data Source=localhost;Initial Catalog=MyDB;User ID=**;Password=**;"
providerName="System.Data.SqlClient" />
</connectionStrings>
ConfigurationManager.ConnectionStrings["MyConnString"].ConnectionString
only two letters away from being an asset
|
|
|
|
|
I want to create table at runtime for an existing Ms Access database using ASP.net 2.0 and C#. Can anyone please guide me through it ?
|
|
|
|
|
arpita2006 wrote: ASP.net 2.0
ASP.NET will not help you because that is a technology for web applications. ADO.NET is that part of the .NET Framework that deals with databases.
With ADO.NET you can issue pretty much any commands that the underlying database understands. So you can use OleDbCommand.ExecuteNonQuery() to issue CREATE TABLE commands. You will need to look up the MS Access reference for details of what SQL you need to perform these actions.
|
|
|
|
|
|
Hi,
I am quite OK with using the System.Drawing class to create an image on the fly, but if I want to save it as a .gif image, how do I create/define/set the colour palette to avoid horrible dithereing if I use anything other than "standard" colours?
Any pointers gratefully appreciated
thanks
Fred
|
|
|
|
|
Web-safe colors are the closest thing to a sure bet. After that, you're on your own.
|
|
|
|
|
hi friends,
i am facing a problem in vs 2005 i am using gridview control and sqldatasource bounded to it
in the update command of the sqldatasource i am passing a query
UPDATE aspnet_UsersInRoles SET RoleId = @RoleId WHERE UserId =@userid
the gridview is having three columns userid,username and roleid among which userid is hidden
if i make this column visible then the above query is working fine but when i make it visible=false then i am getting an
error : Must declare a variable @userid
also i want to know if i place a dropdownlist in gridview how to access its selectedvalues as a parameter
can anybody help me
regards jabbar
jabbarsb
|
|
|
|
|
Hi,
error : Must declare a variable @userid
when column propert visible is false is correct.
Since in visual 2005 if column in visible false then data is not binded to that column.
Sol: To avoid this problem make visible false of column in RowCreated event of grid. This will solve your problem.
hope this helps.
Cheers! Anil
|
|
|
|
|
Does any one know if there is a way to set the order in which HTTPHandlers are called? Or is it determined by the order in which they appear and are rendered on the page?
only two letters away from being an asset
|
|
|
|
|
Hi Mark,
MSDN says about the httpHandlers Element[^]:
"The <httpHandlers> settings are inherited by the application subdirectories.
The <add> directives are processed in top-down, sequential order. If two or more <add> elements specify the same verb/path combination, the final <add> overrides all others."
So, IMHO you can put the handler down on the list if you it to run.
|
|
|
|
|
I probably screwed something up because it didn't seem to process them in the correct order. Thought I might be missing something.
only two letters away from being an asset
|
|
|
|
|
Hi there,
I'm making a website in ASP.net which shows some data from Microsoft SharePoint on it. but an error occured and it says this:
Product registry key not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.SharePoint.Portal.Topology.ProductKeyNullException: Product registry key not found.
Source Error:
[No relevant source lines]
Also this source file: _paj-teg.0.cs in my temporary asp.net files directory
I can't find nothing in internet to resolve this problem, it's a very important project and I can't do anything more
Hope I can get any help here
Hugs
|
|
|
|
|
Aloha,
I'm porting a Wordpress (Linux blog/CMS) based system to ASP.NET. Many of the articles in Wordpress have URLs like www.domain.com/santa-claus.
How do I handle requests to such URLs in ASP.NET. We have ported the data, but our ASP.NET pages have URLs like www.domain.com/article?id=234
I'm considering implementing an IHttpHandler that transforms the requests with the help of a database query (table with Wordpress/ASP.NET matches).
Is that the correct thing to do?
Thank you, Mads
|
|
|
|
|
|
Great, thanks. I'll definately take a look at that one.
Currently my attempt looks like this (no IHttpHandler stuff), it works, but there might be a best practice I don't know about...
<br />
protected void Application_BeginRequest(Object sender, EventArgs e)<br />
{<br />
string requestPath = HttpContext.Current.Request.Path.ToLower(); <br />
if (string.IsNullOrEmpty(requestPath) == false)<br />
{<br />
if (requestPath.Contains(".aspx") == false)<br />
{<br />
int accountItemId = <Database Call><br />
if (accountItemId > 0)<br />
{<br />
string convertedPath = "Article?Id=" + accountItemId.ToString();<br />
HttpContext.Current.RewritePath(convertedPath);<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Hello Friends.
I think this is one of the most innovative and challenging tasks I have ever encountered in my career.
I want to incorporate the Link Grammer open source project for the Open Source WordNet Dictionary.
Link Grammer:
http://bobo.link.cs.cmu.edu/link/index.html[^]
Wordnet:
http://wordnet.princeton.edu/[^]
The Link grammer project is available as a C code+ VC++ code + a API in C# as a console application.
Can anybody help me about this.
Thank You.
|
|
|
|
|
I want to export data from a table(sql) to a CSV file, using asp.net.
Thanks in advance,
Suresh Dayma
|
|
|
|
|
|
Thanks for the Reply.
Regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
Dear all
i'm using a session variable in my application and it's workin fine for some time and if i leave the page for a while the session expires
what i need is to expire the session only when the user closes the browed
(i don't want to set the session timeout to a specific time duration)
how can i implement that?
Best Regards
3ala2
|
|
|
|
|
Make the page request something periodically from the server, so that the session does not time out while the page is open. You can for example use a Javascript to request a small image at a certain interval.
You have to have a timeout on the session, or the server will fill up with old unused session objects.
---
b { font-weight: normal; }
|
|
|
|
|
can u give me an example?
and i think that there is a default timeout for the sessions, right?
i mean why does it disapear after a while without using the page.
I'll try to do the refresh function and c what happens
Thanx for ur response
Best Regards
3ala2
|
|
|
|
|
just3ala2 wrote: i think that there is a default timeout for the sessions, right?
Yes. The default timeout is 20 minutes.
---
b { font-weight: normal; }
|
|
|
|