I am developing a system using VS 2003 with database SQL Server 2000.
In web.config, I have added the following code in it
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Database=grandb;Trusted_Connection=yes"
cookieless="false"
timeout="60"
/>
Actually I don't know if the above code is correct. My database is stored in the SQL Server 2000 and named as grandb.
Thank you.
Hi,
You should modify the <sessionState> tag only when you are using OutProc mode. It seems you want to place you connection string in the web.config file, use this sample setting instead:
<
configuration><appSettings><addkey="connectionString"value="Data Source=127.0.0.1;uid=xxxx;pwd=xxx;database=grandb"/>
</
appSettings>In case you are using windows based authentication in your Sql server, then use the Trusted =yes connection instead of username and password.
You can access this connection string in your source files as:
string
strConn = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];Hope this helps,
Vivek
|||
I add this between appSettings
<add key="DBConnr" value="Data Source=localhost;database=grandb;Trusted=yes" />
However, it still not works...
Any error for that?
Thank you
|||
thtang:
I add this between appSettings
<add key="DBConnr" value="Data Source=localhost;database=grandb;Trusted=yes" />
However, it still not works...
What is the error message are you getting? Are you using Windows authentication in SQL Server or Mixed mode?
Vivek
No comments:
Post a Comment