How to generate connection string? first i have to create a table through which i need to fetch the data and then create a connection string but without doing in webconfig because doing in webconfig is not secure and i have to create a button also after clicking on that it should show a message "connection established" so please help me out from this..

http://www.connectionstrings.com/

Why is the application config unsecure in your situation? It is better practice to put the string here than inside the application so that it can be changed without re-compiling as you deploy to different environments.

See the section in this MSDN article where it discusses encrypting the application config connection string.

commented: Good advice. +14

Even I am not very sure of that but i think webconfig is a web application where we put all information like USER ID, PASSWORD and some more information which is visible for every one thats why it is unsecure. Through default.aspx.cs also can we able to establish connection string or its only possible with webconfig . Do you have any idea about it? Btw Thank you these links are very helpful but i need more details.

The config file would be visible to anyone with access to the server yes. That is why you encrypt the information so that it becomes secure.

It is possible to do within the C# code yes but it is not best practice and the connection string is impossible to change without recompiling the code from an IDE.

Ok, let us know if you run into any issues.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.