|
Thank you for your kind response,
But my concern is ,how can i make function which will execute all queries.
otherwise for each query or Procedure in data base I need to create functions.
|
|
|
|
|
public static DataTable GetTable(SqlCommand cmd)
{
DataTable tbl = null;
SqlConnection conn = null;
try
{
conn =
cmd.Connection = conn;
tbl = new DataTable();
SqlDataReader dr = cmd.ExecuteReader();
tbl.Load(dr);
dr.Close();
dr.Dispose();
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (conn != null)
{
conn.Close();
}
}
return tbl;
}
and in your main class you can call this function as
DataTable tbl = GetTable(cmd);
|
|
|
|
|
Can anyone give me a sample code to create multiple series dynamically and create a legend for all those series in asp.net chart control.
|
|
|
|
|
//design side:
<asp:chart id="yourchart" runat="server" Height="280px" Width="250px">
<titles>
<asp:Title ShadowOffset="3" Name="Title1" />
</titles>
<legends>
<asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="true" Name="Default" LegendStyle="Table" />
</legends>
<series>
<asp:Series Name="Default" /></series>
<chartareas>
<asp:ChartArea Name="ChartArea" BorderWidth="0" />
</chartareas>
</asp:chart>
yourchart.Series[0].XValueMember = "YourColumn";
yourchart.Series[0].YValueMembers = "YourColumn";
yourchart.Series["Default"].IsValueShownAsLabel = true;
yourchart.Series["Default"].ChartType = SeriesChartType.Pie;
yourchart.Series["Default"]["PieLabelStyle"] = "Disabled";
yourchart.ChartAreas["ChartArea"].Area3DStyle.Enable3D = false;
yourchart.Legends[0].Enabled = true;
LegendCellColumn LegendTextColumn = new LegendCellColumn();
LegendTextColumn.ColumnType = LegendCellColumnType.Text;
LegendTextColumn.Text = "#LEGENDTEXT";
yourchart.Legends["Default"].CellColumns.Add(LegendTextColumn);
|
|
|
|
|
I have some excel files on the server. When I am downloading them using asp.net, the downloaded excel file was corrupted. Below is my code. Could anyone tell me where I went wrong.
<pre lang="c#">
string filePath = Server.MapPath("docs\\sample.xls");
string filename = "sample";
HttpResponse res = HttpContext.Current.Response;
res.Clear();
res.AppendHeader("content-disposition", "attachment; filename=" + filename + ".xls");
res.ContentType = "application/octet-stream";
res.Write("<x:Name>" + filename + "</x:Name>");
res.WriteFile(filePath);
res.Flush();
res.End();
</pre>
|
|
|
|
|
Try changing your contentType to "application/vnd.ms-excel"
|
|
|
|
|
Kandepu Rajesh wrote: res.Write("<x:Name>" + filename + "</x:Name>"); That's the line that's causing the problem. You're adding a string to the start of a binary file, which is pretty-much guaranteed to corrupt it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I know there is a million ways to do this. But what I want to happen is to have a spreadsheet/excel that computes for something say grades. The user using the browser (client-side) inputs some integers, the spreadsheet computes. When the user commits. The next time he/she views it from the browser. The changes is there. Please help. Thanks codeproject community!
|
|
|
|
|
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
please help me
|
|
|
|
|
You have an error in your connection string, but not being able to see it or the code surrounding it makes it impossible to say what it is.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Things to check:
1. Make sure your database engine is configured to accept remote connections.
2. Check the SQL Server service account.
3. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASP.NET application. Check you Connection Strings, probably issue is there.
4. You may need to create an exception on the firewall for the SQL Server instance and port you are using
5. Check SQLBrowser; check that it is running.
6. Check that you have connectivity to the SQL Server.
|
|
|
|
|
Hi
I have create three IFrame in same asp.page . But while logout from individual frame it is coming to login page with in frame
But i want to come out from total iframe page . Pl Help me for the code
|
|
|
|
|
are you want to log out from iframe? or you just want to close iframe?
|
|
|
|
|
I have a navigation bar which shows the type of recipe. eg: healthy recipe, desserts, etc...
I have a gridview on the same page. I want the data in the gridview to be populated as per the selection on navigation bar.
I am using VS2010 and sqldatasource to bind with database.
I google a lot but cant find any article based on populating gridview with context to navigation bar.
Plz help.
|
|
|
|
|
Try to Use Query String , in which you can pass any value through url, according to that value you an bind gridview using sql data source
http://www.dotnetperls.com/querystring[^]
follow this link you can learn how to use query string
|
|
|
|
|
hi, I use visual studio 2013 ultimate software for web Asp.net web forms application using vb code and I want to introduce a database but I am a beginner and I do not know anyone can be koi help me and thank you
|
|
|
|
|
File->new->website
select asp.net ( vb)
1.press ( Ctrl+shift+A) to add new item
2.select the database file which is having *.mdf file extension
3.add the file. it will be added to the project's solution explorer and also in server explorer.
continue with your coding
1.make connection string
2.connection open
3.sql query like (insert, update ) query
4.connection close
|
|
|
|
|
our coach gave me an excel file that contains information about Employers I want to put it under visual studio 2013 ultimate and I know how to do it
|
|
|
|
|
|
I have my ProfileCommon Class below
using System.Web.Profile;
public class ProfileCommon : ProfileBase
{
public string LastName
{
get
{
return (string)base["LastName"];
}
set
{
base["LastName"] = value;
this.Save();
}
}
public ProfileCommon GetProfile(string userName)
{
return (ProfileCommon)ProfileBase.Create(userName);
}
}
And the Profile section in the windows service app.config file is below
<profile enabled="true" defaultProvider="SqlProfileProvider" inherits="MyWindowsService.Code.ProfileCommon">
<providers>
<clear />
<add name="SqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="MyConnString" applicationName="Application1" />
</providers>
</profile>
And when i call sample code below
ProfileCommon prf1 = new ProfileCommon();
ProfileCommon prf = prf1.GetProfile("myWindowsLoginName");
string name = prf.LastName;
I get an error "Could not load type 'MyWindowsService.Code.ProfileCommon' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'."
What am i doing wrong in those sample code snippets? OR is this even the right way of using ProfileCommon in a windows service (.NET 4.0), is this wrong all together, is there a better way.
All i want is given a userName, i should get that user's Profile LastName or FirstName from LDAP.
|
|
|
|
|
devenv.exe wrote: inherits="MyWindowsService.Code.ProfileCommon"
According to the documentation[^], the inherits attribute is a "fully qualified type reference". That means you need to specify the assembly name as well.
devenv.exe wrote: All i want is given a userName, i should get that user's Profile LastName or FirstName from LDAP.
I don't see how the SqlProfileProvider is going to load anything from LDAP - it loads and stores the profile properties in SQL. You might have better luck using the System.DirectoryServices.AccountManagement assembly[^] to read this information.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hai All,
As a part of my project I need to plot multiple series of data and need to show the color of each series in the Legend. But when I have added legend , it is diminishing the plotted area. and the plotted area views wiered. Could anyone give me a solution for this.
<pre lang="c#">
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string sqlquery = "select " + dd_axisX.SelectedValue.ToString() + ", " + dd_axisY.SelectedValue.ToString() + " from retrospect where locid=" + ds.Tables[0].Rows[i]["locid"].ToString();
System.Data.DataSet ds_ValuesToPlot = new System.Data.DataSet();
da = new MySqlDataAdapter(sqlquery, con);
da.Fill(ds_ValuesToPlot, ds.Tables[0].Rows[i]["locname"].ToString());
double[] Xdata = ds_ValuesToPlot.Tables[0].AsEnumerable().Select(e1 => Convert.ToDouble(nullconvert(e1[dd_axisX.SelectedValue.ToString()]))).ToArray();
double[] Ydata = ds_ValuesToPlot.Tables[0].AsEnumerable().Select(e1 => Convert.ToDouble(nullconvert(e1[dd_axisY.SelectedValue.ToString()]))).ToArray();
chrt_ScatterPlot.Series.Add(ds.Tables[0].Rows[i]["locname"].ToString());
chrt_ScatterPlot.Series[ds.Tables[0].Rows[i]["locname"].ToString()].ChartArea = "ChartArea1";
chrt_ScatterPlot.Series[ds.Tables[0].Rows[i]["locname"].ToString()].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Point;
chrt_ScatterPlot.Series[ds.Tables[0].Rows[i]["locname"].ToString()].Points.DataBindXY(Xdata,Ydata);
chrt_ScatterPlot.DataBind();
System.Web.UI.DataVisualization.Charting.Legend lgd = new System.Web.UI.DataVisualization.Charting.Legend(ds.Tables[0].Rows[i]["locname"].ToString());
lgd.DockedToChartArea = "ChartArea1";
lgd.Docking = System.Web.UI.DataVisualization.Charting.Docking.Right;
lgd.MaximumAutoSize = 30;
lgd.LegendStyle = System.Web.UI.DataVisualization.Charting.LegendStyle.Row;
chrt_ScatterPlot.Legends.Add(lgd);
chrt_ScatterPlot.DataBind();
chrt_ScatterPlot.ChartAreas[0].Axes[0].Title = dd_axisX.SelectedValue.ToString();
chrt_ScatterPlot.ChartAreas[0].Axes[1].Title = dd_axisY.SelectedValue.ToString();
}
</pre>
|
|
|
|
|
A very simple example of Chart Control with Legend colors:
//design side:
<asp:chart id="yourchart" runat="server" Height="280px" Width="250px">
<titles>
<asp:Title ShadowOffset="3" Name="Title1" />
</titles>
<legends>
<asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="true" Name="Default" LegendStyle="Table" />
</legends>
<series>
<asp:Series Name="Default" /></series>
<chartareas>
<asp:ChartArea Name="ChartArea" BorderWidth="0" />
</chartareas>
</asp:chart>
yourchart.Series[0].XValueMember = "YourColumn";
yourchart.Series[0].YValueMembers = "YourColumn";
yourchart.Series["Default"].IsValueShownAsLabel = true;
yourchart.Series["Default"].ChartType = SeriesChartType.Pie;
yourchart.Series["Default"]["PieLabelStyle"] = "Disabled";
yourchart.ChartAreas["ChartArea"].Area3DStyle.Enable3D = false;
yourchart.Legends[0].Enabled = true;
LegendCellColumn LegendTextColumn = new LegendCellColumn();
LegendTextColumn.ColumnType = LegendCellColumnType.Text;
LegendTextColumn.Text = "#LEGENDTEXT";
yourchart.Legends["Default"].CellColumns.Add(LegendTextColumn);
|
|
|
|
|
I just my text in aspx page to be blink ...............
|
|
|
|
|
There was a <blink> tag - it's deprecated a long ago.
Also was a - non-standard - blink value for the text-decoration attribute - also deprecated.
Ah, and the - non-standard - blink() JavaScript function - deprecated.
Blinking text is very problematic - it's makes you site unfriendly for people with accessibility problems.
You can do some blinking text with JavaScript attached to some timer - or maybe use some animated gif. However for most people (designers and developers) it's not professional...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|