i want to get data from database. I am giving connection string in my web.config file
it looks like
<add name="SampleDataBaseConnectionString" connectionString="Data Source=DREDDY9\SQLEXPRESS;Initial Catalog=SampleDataBase;Integrated Security=True"
from the codebehind file i am trying to accesses data from the DB, The code which i written is mentioned below
string sqlStatement = "select * from Student_Table";
String dataBaseConnection = WebConfigurationManager.ConnectionStrings["SampleDataBaseConnectionString"].ConnectionString;
//String dataBaseConnection = "Data Source=ddaya;Initial Catalog=SampleDataBase;Integrated Security=True";
SqlConnection myConnection = new SqlConnection(dataBaseConnection);
SqlCommand myCommand = new SqlCommand(sqlStatement, myConnection);
dr = myCommand.ExecuteReader();
if (dr != null)
but still it was giving an error like
Cannot open database "SampleDataBase" requested by the login. The login failed.
Login failed for user 'DREDDY9\ASPNET'.
but through sql server i am able to open the DB and i can query.
Follow the steps :
1. Connect to SQL Server Management Studio and login to your server using Console.
2. Go to Security -> Logins -> Right click and select New Login.
3. In login name type DREDDY9\ASPNET, click OK.
Now Move to the yourDataBase Tree node -> security - > users -> Right click -> New User - > Type ASPNET -> and choose Login Name as DREDDY9\ASPNET from browse.
HOw pie chart can be created dynamically by taking data from database.
Please help me out by explaining with an example. Or any references willl do. i searched in net and other forums but was not able to get reference code with "inputs taken from database".
Thanks in advance.
why dont you use RDLC reporting tool to generate PIE charts.
It will be easier to do that. Just design the report with Pie chart in it and load in ReportViewer control on your website.
To do that just look at this article here.[^]
It would be a great task to create the image yourself in the server and present that to the client on the fly.
I will not be able to do that as i am creating aspx and .cs files dynamically from XML/XSL from windows application. Movw all these created aspx and .cs files to a newly created web application. SO i will not be able to do in above said process. I need some code for manipualationa nd display of Pie chart in asp.net for a WEB APPLICATION.
Thanks in advance.
Google Analytics actually captures informations about the visitors of the page and sends the data to the analytics server. The server then analyses each visitor and gives you a complete report based on where the user is most hitting, which area is getting most of attraction etc.
This is a very handy service for commercial web sites. Many of websites uses this feature. If you need all information regarding this please refer :
I'm using Multiple Dropdown list in my website... When country dropdownlist is selected, the appropriate states are loaded, When state dropdownlist is selected, the city will be loaded..... Now, the problem is I cannot able to assign selecteditem for states and city.... Country is loaded at the pageload event... States and cities are loaded dynamically, when selecting the country... How to assign selecteditem for states and city??