|
try this
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
|
|
|
Hi.. now ther was no build errors but after execution.. when i click my button to create Xml file i receive the following exception --->
<br />
It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.<br />
And the line in which this exception ocuurs -->>
if (saveFileDialog.ShowDialog() == DialogResult.OK)
thanx in advance..
Regards,
Tash
|
|
|
|
|
I think you are not use win form application . Is that true if it is then you can't do it using previous procedure.Please use a Custom pop up to do this.
|
|
|
|
|
Ohh no.. so what am i supposed 2 do??? any idea???
regards,
tash
|
|
|
|
|
This will help you much , I think it works fine
Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");
Response.TransmitFile(Server.MapPath("~/images/mmm.jpg"));
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(Response.OutputStream);
Response.End();
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
modified on Thursday, February 4, 2010 6:01 AM
|
|
|
|
|
Try this i think it will help you;
Response.ContentType = "text/xml"; <br />
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");<br />
Response.TransmitFile(Server.MapPath("~/images/sailbig.jpg"));<br />
SqlDataAdapter da = null;<br />
try<br />
{<br />
con = new SqlConnection();<br />
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];<br />
da = new SqlDataAdapter("select * from card_details", con);<br />
DataSet ds = new DataSet(); da.Fill(ds, "card_details");<br />
ds.WriteXml(Response.OutputStream);<br />
Response.End();<br />
}<br />
catch (SqlException ex)<br />
{<br />
throw new System.Exception("Error -- " + ex.Message);<br />
}<br />
catch (Exception exp)<br />
{<br />
throw new System.Exception("Error -- " + exp.Message);<br />
}<br />
finally<br />
{<br />
con.Close(); da.Dispose();<br />
}<br />
<br />
}
|
|
|
|
|
use ...
Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");
Response.TransmitFile(Server.MapPath("~/images/mmm.jpg"));
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(Response.OutputStream);
Response.End();
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
|
|
|
|
|
I think , The below code will help you much
Response.ContentType = "text/xml";
Response.AppendHeader("Content-Disposition", "attachment; filename=mmm.xml");
Response.TransmitFile(Server.MapPath("~/images/mmm.jpg"));
SqlDataAdapter da = null;
try
{
con = new SqlConnection();
con.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
da = new SqlDataAdapter("select * from card_details", con);
DataSet ds = new DataSet(); da.Fill(ds, "card_details");
ds.WriteXml(Response.OutputStream);
Response.End();
}
catch (SqlException ex)
{
throw new System.Exception("Error -- " + ex.Message);
}
catch (Exception exp)
{
throw new System.Exception("Error -- " + exp.Message);
}
finally
{
con.Close(); da.Dispose();
}
|
|
|
|
|
Hi all
When i tried to send email from my website,the mail is going to Queue folder in the server and stayed there and after sometimes some mails will go to my mailbox.Why this happen? If anyone knows about this problem,please help me.
Thanks
Denny
|
|
|
|
|
Member 4260270 wrote: When i tried to send email from my website
I guess you are talking about SMTP Server Queue. Does your SMTP configured properly ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi All,
I created a website using Visual Studio 2005 ASP.NET. Can I run this on a 3rd party server? I purchased a 3rd party web hosting plan ( www.znetindia.com) which supports ASP.NET/SQL/MS Access features.
Can someone tell me how to do this, any links,reference would be useful.
Regards
R.S
|
|
|
|
|
jeshra279 wrote: I purchased a 3rd party web hosting plan
Its not Free right..?
So ask them .they can give better support then us..!
When u Purchase from them, they will be support team from the site hosters..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Hi,
I am having an web site that, two sections.
the first section will have the labels,
and the second section will have the repeater controls,
as per condition the repeater control take some time to load,
so the user does not now what happens as the page remains white.
I plan to go with two update panels for two sections,
that is i can load the first section, and show in the page, and after that i can load the second section, so that the user knows something is going on??
is it feasible with update panels, or is any other method there,
please help me.
|
|
|
|
|
yes you can do it. there is no problem in using two update pagen but i think its must be conditional updates i.e content of the update panel update based on condition
|
|
|
|
|
Thanks Pranay,
but here, i did with that, after i get the content of the first section, i gave the UpdatePanel1.Update(), where the update panels update mode is set to conditional..
but i am not getting any display of the page in the page??
can you please tell me how to do the same.?
|
|
|
|
|
|
I try to open the SQL Server Express database file "sample.mdf" but it doesn't work.
Here is the code:
--------------------------------------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//OleDb-ACCESS
//--------------
//OleDbConnection con = new OleDbConnection();
//string comPath = Server.MapPath("~" + @"\") + @"app_Data\webTest.mdb";
//string coS = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + comPath;
//SqlClient-SQL server express
//------------------------------
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
string comPath = Server.MapPath("~" + @"\") + @"app_Data\sample.mdf";
string coS = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + comPath + ";Integrated Security=True;User Instance=False;";
//OleDb-SQL server express
//-------------------------
//OleDbConnection con = new OleDbConnection();
//string comPath = Server.MapPath("~" + @"\") + @"app_Data\sample.mdf";
//string coS = "Provider=SQLOLEDB.1;" + "Data Source=" + comPath;
con.ConnectionString = coS;
con.Open();
}
}
--------------------------------------------------------------------------
1. Code OleDb-ACCESS (commented) works OK.
2 . When I run the code in section: SqlClient-SQL Server express, I get error:
Server Error in '/myWeb/trySqlServer' Application.
--------------------------------------------------------------------------
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\MyPrograms\web\trySqlServer\app_Data\sample.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file C:\MyPrograms\web\trySqlServer\app_Data\sample.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
---------------------------------------------------------------------------
3. When I run the code in section: OleDB-Sql server express I get error:
----------------------------------------------------------------------------
Invalid authorization specification
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Invalid authorization specification
---------------------------------------------------------------------------------------
What should I do to open the SQL Server database "sample.mdf"?
Thank you
Hezi
|
|
|
|
|
If you are using the the App_Data directory under a Web application then you should be using the |DataDirectory| functionality. Then you don't need to do the Server.MapPath yourself.
On first glance it looks like your SQLEXPRESS instance doesn't have permission to the data directory, the directory doesn't exist, or the file doesn't exist.
But upon closer inspection, you want to remove the setting "User Instance=false" that is going to try to mount the database differently than what you are trying to accomplish. For more information read this.
That being said, having your web app be able to create files, even database files in your sites directories, or even anywhere other than the temp directory is a huge security risk. Consequently, your "CREATE DATABASE" looks to be expected behavior.
One final note:
ASP.NET defines a connectionstring called "LocalSqlServer" in the machine.config, thus it is inherited by all asp.net websites, the default concection string is
data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true
which is nearly identical to your connection string (once the user instance bit is corrected), and the structure of that particular database provides support for all the normal user, password, and permission templates that .NET provides.
|
|
|
|
|
Thank you Alaric. I tried it and it works. Now I would like to switch to SQL SERVER 2005 instead of SQL Server Express. How should I change the connection string?
Thanks,
Hezi
|
|
|
|
|
There are lots of settings in the connectionstring for SQL server, I would visit connectionstrings.com or msdn.microsoft.com to get all the details. But GENERALLY you needs just a handful of settings.
Data Source - this is your server, and instance name, localhost , . , and (local) are all aliases to your local machine. If you are using anything other than the default instance, like SQLExpress, you need to add it after the servername, with a backslash.
User Instance - this is required if you are using SQLExpress and changes how the database is mounted.
AttachDbFilename - is the database file you wish to attach.
Initial Catalog - the name of the database you want to connect to.
So your new connection string, assuming a database name of "cars" on a default instance on your local server using integrated security (so you don't have to store usernames and passwords). It would look like this
Data Source=(local);Initial Catalog=cars; Integrated Security=SSPI;
Notice the AttachDbFilename and User Instance parameters have been removed.
|
|
|
|
|
i want to retain data of previous screen as i move to next. so as onclicking previous button,i have not to reload data
|
|
|
|
|
use javascript on previous button click
javascript:history.go(-1)
|
|
|
|
|
cache your previuos data and when you come back retrieve your data from cache...
Thanks
|
|
|
|
|
Try using the ASP.Net Wizard control first.
|
|
|
|
|
Hi ,
IE showing a warning message when I refresh my page.It says "If you were making a purchase , you should click cancel to avoid a duplicate transaction.Otherwise click retry to display the web page again".How can I avoid this ?
With regards ,
|
|
|
|