|
Hey guys, I have created a connection string in my web.config and I wanna use it in my forms I use the following code
Configuration connn = new Configuration();<br />
MyConn.ConnectionString = connn.ConnectionStrings.ConnectionStrings.ToString();
But when I use that for my connection I get this error that I need to define a constructor !
what should I do ?
Thanx
Mr.K
|
|
|
|
|
mrkeivan wrote: Configuration connn = new Configuration();
This is not how to access variables in your web.config.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Could you please tell me how then !
Mr.K
|
|
|
|
|
mrkeivan wrote: Configuration connn = new Configuration();
What is this class ? To get connection string from web.config, use ConfigurationsSettings.AppSettings
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["value"]
|
|
|
|
|
hey, thanx man ! by the way, whats the value ? should I replace it with something ?
Mr.K
|
|
|
|
|
yeah, you should replace it with the key name in the web.config. For example if you have <add key="mailServer" value="localhost"/> , then value would be mailServer .
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
OK I have
<add name="MyDBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDB.mdf;Integrated Security=True;User Instance=True"<br />
providerName="System.Data.SqlClient" />
But it doesn't let me use that !!!
...AppSettings[MyDBConnectionString];
Mr.K
|
|
|
|
|
It seems that your connection string is not defined in the <appSettings> node.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Your web.config, appsettings would look like this
<appSettings>
<add key="AnyName" value="ConnectionStringGoesHere"/>
</appSettings>
By value, I mean the key name to access the connection string. To access this value you need to write
string ConnectionStr = ConfigurationSettings.AppSettings["AnyName"];
|
|
|
|
|
<add key="ConnS" value="">
in the value part I tried to use my connection "Data Source=.\SQLEXPRESS;..."
but I got this error >> Unrecognized configuration section add
Do you have any project or link from which I can have a sample ??
Thanx
Mr.K
|
|
|
|
|
There is a table in my aspx page and there are six buttons in that tale.if I select any button then it works as i want.
But by default First button get selected.But i want that button should be selected that I clicked.
What is the process.Do i have to change any property.
Can anybody help me .It is very urgent.
Thanks
Raghvendra Kumar Roy
|
|
|
|
|
Raghvendra Kumar Roy wrote: But by default First button get selected.But i want that button should be selected that I clicked.
When first button is getting selected ? When you press enter key or when click on that button ?
|
|
|
|
|
when i click any button then first button is getting selected
Raghvendra Kumar Roy
|
|
|
|
|
Raghvendra Kumar Roy wrote: hen i click any button then first button is getting selected
Selected or is it firing first button code ? Make sure events are added properly.
|
|
|
|
|
Raghvendra Kumar Roy wrote: It is very urgent
There's a surprise. Try a sensible header, they actually work better.
Raghvendra Kumar Roy wrote: Can anybody help me .It is very urgent.
I find it hard to believe that this is super urgent. What do you mean by 'selected' ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
What is wrong with the following:
Dim nodesArray() As String
Dim i As Integer = 0
For Each node As RadTreeNode In nodes
nodesArray(i) = node.Value
i = i + 1
Next
I'm trying to populate an array, but I keep on getting the following error:
Object reference not set to an instance of an object.
Please can some one help?
Regards
|
|
|
|
|
.NET Enthusiast wrote: Dim nodesArray() As String
You have not initialized your array. Try
Dim nodesArray() As New String
|
|
|
|
|
C:\Inetpub\wwwroot\...\PowerSearch.aspx.vb(317): Arrays cannot be declared with 'New'.
Any other ideas??
|
|
|
|
|
VB.NET I don't know. C# you can instantiate array's like
string[] Arr = new string[10];
|
|
|
|
|
Instead of an array ( which is empty, because you've not called new on it ), try using a List of string. Or just call new on the array, so that it has the space to add the values you're adding.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
HI!
when user press enter on a textbox, cursor move to next textbox. is it possible without using javascript?
|
|
|
|
|
fmlove wrote: without using javascript?
Of course not. Why do people keep asking questions in this forum and saying 'without using javascript'. You have NO other options on the client side, unless you want to support IE only and use VBScript.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Because i write a javascript but it not support on Firefox Browser
|
|
|
|
|
Hi,
This is from Chandrakanth. I am using GridView Control. And I would like
to update the records through Coding. Can any one tell me how to go for
that.
Thansk in Advance
With Regards
Chandrakanth
Chandrakanth
|
|
|
|
|
A gridview supports in place adding and editing of rows. Deleting is also easy to add. There are tons of tutorials on the web, there's no way I could explain it as well as an article could, in a forum reply.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|