|
ya, i have closed all the objects and connections related to this.
G. Satish
|
|
|
|
|
I think you have the file open and are trying to use that.
Close the file and retry.
Regards
Vijay V.
Yash Softech
|
|
|
|
|
My code is as follows. I am Getting error here... as
"Excel Excep:The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data."
public DataTable ReadingDatafromExcel()
{
DataTable dt = new DataTable();
try
{
string FilePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
string _filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
string _attachpath = FileUpload1.PostedFile.FileName;
string _fileexten = Path.GetExtension(FileUpload1.PostedFile.FileName);
string strConn = "";
if (_fileexten == ".xls")
{
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + _attachpath + ";" +
"Extended Properties=Excel 8.0;";
}
else if (_fileexten == ".xlsx")
{
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" +
"Data Source=" + _attachpath + ";" +
"Extended Properties=Excel 12.0;";
}
OleDbConnection oledbconn = new OleDbConnection(strConn);
oledbconn.Close();
oledbconn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", oledbconn);
DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet, "ExcelInfo");
dt = myDataSet.Tables[0];
oledbconn.Close();
myCommand.Dispose();
DataColumn dcGender = new DataColumn("Gender", System.Type.GetType("System.String"));
dt.Columns.Add(dcGender);
DataColumn dcCulture = new DataColumn("Culture", System.Type.GetType("System.String"));
dt.Columns.Add(dcCulture);
}
catch (Exception dataex)
{
Response.Write("Excel Excep:" + dataex.Message.ToString());
}
return dt;
}
G. Satish
|
|
|
|
|
I have placed the following code on a web page. It works fine on the development machine. But when I publish the web site to the production server, this object is never rendered. An Internet Explorer error is displayed: Object doesn't support this property or method. I get this same error on the local machine if I change the url to an incorrect url. This is a TXTextControl project. I am at a total loss as to why this will not function on the production server. Any help would be appreciated.
<object classid="http:BrowserBin/BKDocuments.dll#BKDocuments.DocBrowserAppControl"
id="DocBrowserApp" name="DocBrowserApp" width="800" height="500">
</object>
|
|
|
|
|
For this to work, the control needs to be registered on the machine that views your site. There are bound to be other security issues also. Best approach is don't do it.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I get
$exception {"Index (zero based) must be greater than or equal to zero and less than the size of the argument list."} System.Exception {System.FormatException}
when trying to testing this code
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace FileWatchingDemo
{
class Program
{
static void Main(string[] args)
{
FileSystemWatcher watcher = new FileSystemWatcher(Environment.SystemDirectory);
watcher.Filter = "*.ini";
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter = NotifyFilters.Attributes | NotifyFilters.Size;
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
watcher.EnableRaisingEvents = true;
Console.Read();
}
static void watcher_Changed(object sender, FileSystemEventArgs e)
{
Console.WriteLine("Changed: {1}", e.FullPath);
}
}
}
It seems this line
Console.WriteLine("Changed: {1}", e.FullPath);
has problem but I just don't know how to solve it.
I am new to ASP.NET and please help!!
|
|
|
|
|
Yifei Jia wrote: Console.WriteLine("Changed: {1}", e.FullPath);
Are you doing it in ASP.NET ?
|
|
|
|
|
Arrays in programming are 0 indexed. You specify {1}, which means the second argument, but you only provide one. Replace the 1 with a 0.
And as someone else said, this doesn't look remotely like ASP.NET code. In fact, it isn't.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
admin page has a detailsview
hikingpage has a gridview
problem is when i enter the second image instead of a new row the image replace's the first image and the rest of the row appears farther down the gridview
here is the codebihind that i used
Imports System.Data
Partial Class Admin
Inherits System.Web.UI.Page
Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles DetailsView1.ItemInserted
'If the record was successfully inserted,save the picture
If e.AffectedRows > 0 Then
Dim results As DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
Dim PictureIDJustAdded As Integer = CType(results(0)(0), Integer)
'Reference the FileUpload control
Dim imageUpload As FileUpload = CType(DetailsView1.FindControl("imageUpload"), FileUpload)
If imageUpload.HasFile Then
Dim basedirectory As String = Server.MapPath("~/UploadedImages/")
imageUpload.SaveAs(basedirectory & PictureIDJustAdded & ".jpg")
End If
End If
End Sub
End Class
this is the codebehind on the admin page
can anyone help me out here
|
|
|
|
|
If the files are just stored in the file system, how do they stay associated with the rows of your grid as you add them ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'm working on my first ASP.NET application ever, so this might be an easy problem to solve for you.
I'm collection data from different xml files and want to store them in an DataSet.
The data will be shown with an repeater.
The page will show something like this: (Short version, will be lots of more information)
Miami Engineering
1. General
Doc one
Doc two
2. Feasibilty calculations
Doc three
Doc four
Doc five
When I try to add the data to my DataSet the way I was thinking, I get the error "A DataTable named 'Document' already belongs to this DataSet."
This is when I try to make a DataSet with this structure:
<projects>
<project>
<projectname> Miame Engineering <projectname>
<project>
<part>
<partname> 1. General </partname>
</part>
<document>
<documentname> Doc one </documentname>
</document>
<document>
<documentname> Doc two </documentname>
</document>
<part>
<partname> 2. Feasibilty calculations </partname>
</part>
<document>
<documentname> Doc three </documentname>
</document>
<document>
<documentname> Doc four </documentname>
</document>
<document>
<documentname> Doc five </documentname>
</document>
</projects>
How will I build my DataSet so I can get the output that I want?
modified on Monday, November 17, 2008 5:03 PM
|
|
|
|
|
I am not sure why you're using a dataset, but it doesn't look to me like the data you're using is compatible, unless you specify a maximum number of doctors.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'm using a DataSet because I want to be able to add, delete and change data in it.
What do you mean with specifying maximum number of documents?
Haven't seen that option, so how do I do that?
|
|
|
|
|
Miami Engineering
1. General
Doc one
Doc two
2. Feasibilty calculations
Doc three
Doc four
Doc five
This is a tree, with three levels. You would have to create three tables and define the relationship between them, to reproduce this structure. Not sure if .NET is smart enough to do that by itself.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i have a problem. please help.
user control is dynamically added when gridview is selected( invoice number is selected) so far so good. but when a second selection is made
the previous control appears again, naturally. so i want to register usercontrol a new every time grid is selected, how can i do that?
|
|
|
|
|
What do you mean by 'register' ? I think you want to create one control, and then move it if it already exists, b/c viewstate is causing it not to be removed ( or just explicitly remove from all rows but the selected one when you add a new one )
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
:~i'm creating a .csv file on the fly, thus am enclosing all the data within double quotes.
how to put in a newline character is the problem. for eg:-
i tried the following -
"header1","header2","header3"\n"data1","data2","data3"\n"data11","data22","data33"
and
"header1","header2","header3 \n"\r\n "data1","data2","data3 \n"\r\n "data11","data22","data33"
so that the output looks like
header1 header2 header3
data1 data2 data3
data11 data22 data33
thanks a lot for your help
|
|
|
|
|
You need to add the Carriage Return and New Line characters:
Chr(13) & Chr(10)
(in VB you can use the pre-defined ocnstant vbCrLf)
where you want the line breakx to be.
|
|
|
|
|
NEVER use \r\n, use Environment.NewLine
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have a web service in my site, i have session statemanagement to autodetect wheter or not the browser has cookies enabled
<sessionState
mode="SQLServer"
timeout="30"
cookieless="AutoDetect"
</sessionState>
When i try to add the web reference i get an error:
There was an error downloading 'http://localhost/V01/WebService.asmx?op=PedidosNuevos'.
The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/V01/WebService.asmx?op=PedidosNuevos&AspxAutoDetectCookieSupport=1">here</a>.</h2>
</body></html>
In the add webreferece dialog, i can call the web method, i also called it from ie and it works as expected, the only problem is that i cant add it to my project as a web reference
I think it must be because of the redirection to detect if cookies are enabled
How can i add it??
Thanks for any help
Alexei Rodriguez
|
|
|
|
|
I had the same issue; The only way to solve it was to set cookieless="False" in order to add the web reference then set it back to AutoDetect.
If you find a better solution, please let me know!
|
|
|
|
|
Yes, i remember that problem, long time ago.
I had to add to reference as follows:
http://servername/WebService.asmx?WSDL&AspxAutoDetectCookieSupport=1
And i dont remember the reason why, but in my code behind in the load event i have this code:
Me.webservice.Url &= "?AspxAutoDetectCookieSupport=1"
In case you get an error add this part
Alexei Rodriguez
|
|
|
|
|
Hello,
Can somebody give me an example, how can I embed "own" asp.net Controls.
For example I can download a dll here for a special Listbox-control.
What I have to do that I can use this Control?
Thanks
|
|
|
|
|
Add to reference library maybe?
|
|
|
|
|
I added the dll allready as reference to the Project, but what now?
I think i have to create a Tag now and config something?
|
|
|
|