|
Can you tell me what is you exact requirment ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
i want to have a calendar inside a dropdown list or attached to a text box.can u help me
|
|
|
|
|
|
Hello Friends,
I'm generating a xml file from sql table in asp.net(c#). Here is my code given below
using (SqlConnection mCon = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()))
{
mCon.Open();
string strsql = "Select * From MakeTable Where Active=1 For XML Auto,ELEMENTS";
//string strsql = "Select * From MakeTable Where Active=1 ";
SqlCommand mDataCom = new SqlCommand();
mDataCom.Connection = mCon;
mDataCom.CommandText = strsql;
mDataCom.CommandTimeout = 15;
DataSet ds = new DataSet();
XmlReader xmlReader = null;
xmlReader = mDataCom.ExecuteXmlReader();
ds.ReadXml(xmlReader);
ds.DataSetName = "Halo";
ds.WriteXml("F://Manoj//Autoneed/Rough//XMLFile2.xml");
}
but it's giving me output as shown here
<MakeTable>
<MakeID>10</MakeID>
<MakeNameID>36</MakeNameID>
<MakeYear>2009</MakeYear>
<Active>1</Active>
</MakeTable>
but if i run my sql command in sql then it's giving me following records
as shown below
<MakeTable>
<MakeID>1</MakeID>
<MakeNameID>17</MakeNameID>
<MakeYear>2009</MakeYear>
<Active>1</Active>
</MakeTable>
<MakeTable>
<MakeID>3</MakeID>
<MakeNameID>17</MakeNameID>
<MakeYear>2006</MakeYear>
<Active>1</Active>
</MakeTable>
<MakeTable>
<MakeID>4</MakeID>
<MakeNameID>17</MakeNameID>
<MakeYear>2007</MakeYear>
<Active>1</Active>
</MakeTable>
<MakeTable>
<MakeID>5</MakeID>
<MakeNameID>17</MakeNameID>
<MakeYear>2005</MakeYear>
<Active>1</Active>
</MakeTable>
<MakeTable>
<MakeID>7</MakeID>
<MakeNameID>17</MakeNameID>
<MakeYear>2004</MakeYear>
<Active>1</Active>
</MakeTable>
can anybody let me know how can i get this output or where and what change i should make in my code or sqlcommand
|
|
|
|
|
What happens if you try this?
while (xmlReader.Read())
{
ds.ReadXml(xmlReader);
ds.DataSetName = "Halo";
ds.WriteXml("F://Manoj//Autoneed/Rough//XMLFile2.xml");
}
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
it didn't dawn on me at first glance that you had a dataset in there...so I don't think the above would work. Since it appears to be coming back from the SQL server correctly, what if you avoided the DataSet all together and just saved it straight to a file?
TextWriter tw = new StreamWriter("output.xml");
while (datareader.read())
{
tw.WriteLine(datareader.ToString());
}
tw.Close();
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
Is it mandatory for you to write down the file to the server?????
why don`t you try
ds.GetXml();
But remember to fill you dataset with the data.
which actually returns you a XmlDocument. Debug your code and see what results you get in the document object.
When you fail to plan, you are planning to fail.
|
|
|
|
|
Hi all,
I have div with property
there are some more div below this div in different table i am making its visible on click of link its working in IE 7 but not in IE 8.In IE 8 its not visible properly means not expanding its hidden by below text.
Thanks.
|
|
|
|
|
Sorry Dude ? I have div with property ..!What is the Question?
|
|
|
|
|
hi friends,
On a web page, when iam clicking a button it is displaying a popup
but i applied prop "Opacity" in CSS to that popup. which is not working. mine IE VERSION IS 8.0. where the same opacity is working fine in mozilla firefox.
|
|
|
|
|
Sorry for the distrubing. Please give your answer.
Now, I want store a picture in database. Later retrieve the picture
from database and show in a page.
1. Which type of datatype to create in SQL?
and
2. How to retrieve from (picture) data and display on IE.
Please give exact coding.
Thanking you,
abglorie
|
|
|
|
|
|
I am agree what sashidhar suggested,
You can do one more thing, rather than sotring image in DB in byte format, store image in your hard drive and store the path in Database.
Retreive the path from database, and display the image from your hard drive. This will make your task simple.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I have a problem , that
see if a user is filling a information page , after filling more then half, suddenly system automatically shuts down. so again user start the system . so is it possible that when he open that page again, it should be half filled from where the system shut down.
|
|
|
|
|
Hi ,
I want to display image from the particular path in ASP:Image . what is the procedure for this for this.
Thanks,
Amit PAtel
|
|
|
|
|
add in your project folder the image and in the image url of the image control properties give that path
|
|
|
|
|
you shud create image folder in ur own project then only u can access
that image....
|
|
|
|
|
Hi ,
Byte array is coming from the data base at that time i want to display.
Thanks,
Amit PAtel
|
|
|
|
|
|
Amit Patel1985 wrote: Byte array is coming from the data base at that time i want to display.
So you mean, you want to show Image from database ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Yes image coming from the data base
|
|
|
|
|
hiii
i have a Product.db table in which i have columns:
PID:Autonumber
ProductID:indexed(yes (no duplicate))
Productname:
ProductDescription:
ProductPrice:
VendorID:
m using following code to insert data n update data on button click in my table:
protected void Button4_Click(object sender, EventArgs e)
{
string str1 = "Select MAX(PID) From Product";
OleDbCommand cmd = new OleDbCommand(str1, conn);
OleDbDataReader dr = null;
conn.Open();
string max = cmd.ExecuteScalar().ToString();
if (max != "")
{
max = "PID" + max;
}
else
{
max = "PID" + 1;
}
conn.Close();
string str = "Insert Into Product(ProductID,ProductName,ProductDescription,ProductPrice)Values('"+max+"','" + txtprdtname.Text + "','" + txtprdtdescrp.Text + "','" + txtprdtprice.Text + "')";
cmd = new OleDbCommand(str, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
str = "Select * From Product";
cmd = new OleDbCommand(str, conn);
OleDbDataReader dr1 = null;
conn.Open();
dr1 = cmd.ExecuteReader();
DropDownList2.DataSource = dr1;
DropDownList2.DataTextField = "ProductID";
DropDownList2.DataValueField = "ProductID";
DropDownList2.DataBind();
conn.Close();
string str3 = "Select Max(PID) From Product";
cmd = new OleDbCommand(str3, conn);
conn.Open();
string max1 = cmd.ExecuteScalar().ToString();
string max2 = "PID" + max1;
conn.Close();
string str2 = "Update Product Set ProductID='" + max2 + "' Where(PID=" + max1 + ")";
cmd = new OleDbCommand(str2, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
but when i execute it i get following error:
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
Plz guide me where m i wrong....
|
|
|
|
|
mylogics wrote: PID:Autonumber
mylogics wrote: string str1 = "Select MAX(PID) From Product";
OleDbCommand cmd = new OleDbCommand(str1, conn);
OleDbDataReader dr = null;
conn.Open();
string max = cmd.ExecuteScalar().ToString();
if (max != "")
{
max = "PID" + max;
}
else
{
max = "PID" + 1;
}
You have set the PID:Autonumber in database?
If yes then no need to include it in insert/update query. It will be automatically created by database.
Just include the other fields in insert/update query except PID.
HTH
|
|
|
|
|
m not insertin PID in Product table but m inserting ProductID value and it is
necessary as it is primary key and cannot be null.
|
|
|
|
|
Well! i have been struggle with this error! pls help
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +41
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +119
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +179
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +95
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +192
|
|
|
|