|
I am working on a web application project. I am using c# as my programming language and an oracle 10g database.
I am in a situation where I need to read a large text file and Insert it in to an Oracle database.
I have used steamreader and the Oracle's odp.net and was able to successfully insert the text into a table.
Can one of you seasoned developres show me how to do the samething using Microsoft data provider(System.Data.Oracleclient name space)and streamreader. I appreciate your help.
|
|
|
|
|
In .net 2005 I have created Application
I want to create a log file, which maintains all the internal process so at the run time I want to create a file at the source
Code:
Private string LogFileName = "ADM_Log.txt";
LogFileName = Application.ExecutablePath + "\\" + LogFileName;
This return path like this
"F:\\Joe Don't Delete\\DotNet_Samples\\ADM\\ADM\\ADM\\bin\\Debug\\ADM.EXE\\ADM_Log.txt"
1. Why the path is return with \\?
2. If I use this path in
Code:
File.Create(LogFileName);
The error message is shown like this:"Could not find a part of the path 'F:\\Joe Don't Delete\\DotNet_Samples\\ADM\\ADM\\ADM\\bin\\Debug\\ADM.EXE\\ADM_Log.txt'."
If i give manually path with single \
It creates the File.
Then
I use this function to write information in the file
At first the file is created in single \ then it goes to this function
At first line of this function it throws message "the file is exclusively opened by another user"
Private void WriteLog(string sMessage)
{
StreamWriter sw1 = File.AppendText(LogFileName);
sMessage = ("::" + sMessage);
sw1.WriteLine(sMessage);
sw1.Close();
}
Please help me these all my problems
Thank u
|
|
|
|
|
joerozarioia wrote: LogFileName = Application.ExecutablePath + "\\" + LogFileName;
Use Path.Combine to do this.
joerozarioia wrote: 1. Why the path is return with \\?
Are you looking in the debugger ? The debugger will render it like this
joerozarioia wrote: StreamWriter sw1 = File.AppendText(LogFileName);
This function tries to open the file. You have not closed the file when you created it, so you still have another lock on it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yes i am looking in debuger
plese tellme how to close the file and then i could open throw streamWriter
|
|
|
|
|
hiya
i'm back
i'm using the following code to load the webpage
private void setHtmlPage()
{
object p1="";
object p2="";
object p3="";
object p4="";
string URL1 = Application.StartupPath + "\\introduction.html";
axWebBrowser1.Navigate(URL1,ref p1,ref p2,ref p3,ref p4);
}
however the page that is displayed is of the page cannot be diplayed.... it doesn't show the contents of my web page.
what is it that i'm missing ????
|
|
|
|
|
Why do you need to provide four objects ? I never do. I think I set the Url directly tho.
Get the path in question ( the value of URL1 ) and try it in IE, to make sure it is valid.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks dude, i just found the mistake.
untill the next problem
regards
|
|
|
|
|
Hi,
Here is the architecture.
There is a business layer set up as a peoject with a class i.e. class1
Class1 has two functions. One to populate a hashtable with 10 data and the other to count the data in the hashtable.
There is a windows service i.e. WindowsService1 that calls the populate function in the business layer.
The count on the hashtable is 10
There is another windows service i.e. windowsService2 which call the same businesslayer to count the hashtable. The couont on the hashtable is 0
Do you know why this is the case and is there a solution to this please?
Thanks
|
|
|
|
|
arkiboys wrote: Do you know why this is the case
Yes[^]
arkiboys wrote: is there a solution to this please?
Yes[^]
led mike
|
|
|
|
|
Hi,
Don't quite understand the article.
Can you explain it simply please?
|
|
|
|
|
He's saying that each webservice will have an instance of hte class in their own process space. If you start Solitaire twice on your PC, the cards in one game won't change what the cards are in another. That's what you're trying to do, to make two programs share data.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, I have now come to that conclusion. And that is exactly what I am trying to do. i.e. applications to shhare the hashtables from a common dll.
1)
What is the alternative and how can I do this please?
2)
Would you say it is better if I save the data into files on the disk and share it that way?
4)
Someone said it is possible to share the hashtable data via a webservice. What do you think?
Thanks
|
|
|
|
|
Hi,
I thought there was a property where i could say if a form maximizes at load time, but i cant find any.
Can anyone help me out on how to do this?
Thx,
Nuno
|
|
|
|
|
WindowState, I believe, is the property you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
open the properties of the page u want to maximize and set the property of "Window State" that is the very last property in the layout poperties if u are working with .Net 2000.
set the property to maximized
hope this helps.
|
|
|
|
|
Once again, thank you very much guys!
|
|
|
|
|
Hi,
I want to allow the user to right click on one or more files in the Explorer and then select a custom context menu entry like "Process with myProgram" (beside "Open", "SendTo" etc.).
I found out that it is quite easy to add such an entry for a Folder. To do this you just have to set up a new SZ entry in the System-Registry under "HKEY_CLASSES_ROOT -> Folder -> shell -> Process with myProgram -> Command" which contains the path to the program as value.
But that does not work with special file types. Does anybody have an idea how to do that?
Thanks in advance!
Alexander
P.S.: Working with Framework 1.1
|
|
|
|
|
This article Customize explorer's devious context menu[^] probably helps you.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank you for this interesting article. I tried the test program and unfortunately it did not work (seems not to make an entry into the System-Registry).
But I´ll have a closer look into the code tomorrow.
|
|
|
|
|
Hi,
I have a small windows application that connects to the local directory and retrieves the list of users. Then, it is possible to display the data of the user by clicking on a button. I use LDAP://DomainName to connect and things "seem" to be working fine. I manage to get the different data of the user I select (name, country, address, email, phone etc...) however I am having a problem with the "memberof" property. For some users, I am able to retrieve the list of groups he belongs to but for other users the property returns an empty collection. I am using the following piece of code:
<br />
SearchResultCollection src = ds.FindAll();<br />
SearchResult sr = src[0];
ResultPropertyValueCollection memberOf = sr.Properties["memberOf"];
ResultPropertyValueCollection givenName = sr.Properties["givenName"];<br />
ResultPropertyValueCollection lastName = sr.Properties["sn"];<br />
ResultPropertyValueCollection email = sr.Properties["mail"];<br />
ResultPropertyValueCollection address = sr.Properties["homePostalAddress"];<br />
ResultPropertyValueCollection zip = sr.Properties["postalCode"];<br />
ResultPropertyValueCollection country = sr.Properties["co"];<br />
ResultPropertyValueCollection title = sr.Properties["title"];<br />
ResultPropertyValueCollection city = sr.Properties["l"];<br />
ResultPropertyValueCollection state = sr.Properties["st"];<br />
ResultPropertyValueCollection phone = sr.Properties["telephoneNumber"];<br />
ResultPropertyValueCollection otherPhone = sr.Properties["otherTelephone"];<br />
ResultPropertyValueCollection fax = sr.Properties["facsimileTelephoneNumber"];<br />
Then I filter the memberof collection like this:
<br />
foreach (object role in memberOf)<br />
{<br />
string[] roleItems = role.ToString().Split(',');<br />
foreach (string temp in roleItems)<br />
{<br />
int i = temp.IndexOf("CN=");<br />
if (i >= 0)
{<br />
listGroups.Items.Add(temp.Substring(3));<br />
}<br />
}<br />
}<br />
This will give me the group name. I have tried displaying the whole "role" string without parsing, I thought maybe my parsing was not complete, but I didn't get anything either.
I am new in Active Directory stuff and I have no idea if there is another way to do things.
Any help would be greatly appreciated.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Greetings,
On a web page I have create several Gridviews dynamically as a result of a stored procedure.
The gridviews are building well and filled with data.
I also created the select and edit button on every gridview.
I also created several eventhandlers, delegates etc for these gridviews.
But what button's) I press on the grid, I never get into the subroutines I created for these purposes.
Do I also need to create something (a connection) for the dynamically created buttons and the events?
Thanks for every advice
Code:
public partial class Planning3 : System.Web.UI.Page
{
//Delegates ====================
//
//GridViewSelectEventHandler Delegate; Represents the method that handles the SelectedIndexChanging event of a GridView control.
public delegate void GridViewSelectEventHandler(Object sender, GridViewSelectEventArgs e);
//Gridview Rowcommand
public delegate void GridViewCommandEventHandler(Object sender, GridViewCommandEventArgs e);
//Delegates END ====================
private GridView CreateGridObject()
{
string stemp = "";
try
{
GridView GridViewObj = new GridView();
GridViewObj.ID = "Ellende";
GridViewObj.AutoGenerateColumns = false;
//GridView1.DataKeyNames = new string[] { "EmployeeID" };
GridViewObj.AllowPaging = true;
GridViewObj.AllowSorting = true;
GridViewObj.PageSize = 5;
//Select button
CommandField cfSelect = new CommandField();
cfSelect.ButtonType = ButtonType.Button;
cfSelect.ShowCancelButton = true;
cfSelect.ShowSelectButton = true;
GridViewObj.Columns.Add(cfSelect);
//Edit button
CommandField cfEdit = new CommandField();
cfEdit.ButtonType = ButtonType.Button;
cfEdit.ShowEditButton = true;
cfEdit.ShowCancelButton = true;
GridViewObj.Columns.Add(cfEdit);
//We need to add several eventhandlers
GridViewObj.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.GridView1_RowCommand);
GridViewObj.SelectedIndexChanged += new EventHandler(this.GridView1_SelectedIndexChanged);
GridViewObj.SelectedIndexChanging += new System.Web.UI.WebControls.GridViewSelectEventHandler(this.GridView1_SelectedIndexChanging);
//Do I need to create a connection between the button and events?
BoundField bfRecID = new BoundField();
bfRecID.HeaderText = "RecID";
bfRecID.DataField = "RecID";
bfRecID.ReadOnly = true;
GridViewObj.Columns.Add(bfRecID);
BoundField bfUserID = new BoundField();
bfUserID.HeaderText = "UserID";
bfUserID.DataField = "UserID";
bfUserID.ReadOnly = true;
GridViewObj.Columns.Add(bfUserID);
BoundField bfGroupUserID = new BoundField();
bfGroupUserID.HeaderText = "GroupUserID";
bfGroupUserID.DataField = "GroupUserID";
bfGroupUserID.ReadOnly = true;
GridViewObj.Columns.Add(bfGroupUserID);
BoundField bfManagerID = new BoundField();
bfManagerID.HeaderText = "ManagerID";
bfManagerID.DataField = "ManagerID";
bfManagerID.ReadOnly = true;
GridViewObj.Columns.Add(bfManagerID);
BoundField bfManagerYN = new BoundField();
bfManagerYN.HeaderText = "ManagerYN";
bfManagerYN.DataField = "ManagerYN";
bfManagerYN.ReadOnly = true;
GridViewObj.Columns.Add(bfManagerYN);
BoundField bfName = new BoundField();
bfName.HeaderText = "Employee Name";
bfName.DataField = "Name";
bfName.ReadOnly = true;
GridViewObj.Columns.Add(bfName);
BoundField bfTask1 = new BoundField();
bfTask1.HeaderText = "Task1";
bfTask1.DataField = "Task1";
bfTask1.ReadOnly = false;
GridViewObj.Columns.Add(bfTask1);
BoundField bfTask2 = new BoundField();
bfTask2.HeaderText = "Task2";
bfTask2.DataField = "Task2";
bfTask2.ReadOnly = false;
GridViewObj.Columns.Add(bfTask2);
BoundField bfTask3 = new BoundField();
bfTask3.HeaderText = "Task3";
bfTask3.DataField = "Task3";
bfTask3.ReadOnly = false;
GridViewObj.Columns.Add(bfTask3);
BoundField bfTask4 = new BoundField();
bfTask4.HeaderText = "Task4";
bfTask4.DataField = "Task4";
bfTask4.ReadOnly = false;
GridViewObj.Columns.Add(bfTask4);
BoundField bfTask5 = new BoundField();
bfTask5.HeaderText = "Task5";
bfTask5.DataField = "Task5";
bfTask5.ReadOnly = false;
GridViewObj.Columns.Add(bfTask5);
BoundField bfTask6 = new BoundField();
bfTask6.HeaderText = "Task6";
bfTask6.DataField = "Task6";
bfTask6.ReadOnly = false;
GridViewObj.Columns.Add(bfTask6);
BoundField bfTask7 = new BoundField();
bfTask7.HeaderText = "Task7";
bfTask7.DataField = "Task7";
bfTask7.ReadOnly = false;
GridViewObj.Columns.Add(bfTask7);
BoundField bfTask8 = new BoundField();
bfTask8.HeaderText = "Task8";
bfTask8.DataField = "Task8";
bfTask8.ReadOnly = false;
GridViewObj.Columns.Add(bfTask8);
BoundField bfTask9 = new BoundField();
bfTask9.HeaderText = "Task9";
bfTask9.DataField = "Task9";
bfTask9.ReadOnly = false;
GridViewObj.Columns.Add(bfTask9);
BoundField bfTask10 = new BoundField();
bfTask10.HeaderText = "Task10";
bfTask10.DataField = "Task10";
bfTask10.ReadOnly = false;
GridViewObj.Columns.Add(bfTask10);
BoundField bfTask11 = new BoundField();
bfTask11.HeaderText = "Task11";
bfTask11.DataField = "Task11";
bfTask11.ReadOnly = false;
GridViewObj.Columns.Add(bfTask11);
BoundField bfTask12 = new BoundField();
bfTask12.HeaderText = "Task12";
bfTask12.DataField = "Task12";
bfTask12.ReadOnly = false;
GridViewObj.Columns.Add(bfTask12);
BoundField bfTask13 = new BoundField();
bfTask13.HeaderText = "Task13";
bfTask13.DataField = "Task13";
bfTask13.ReadOnly = false;
GridViewObj.Columns.Add(bfTask13);
BoundField bfTask14 = new BoundField();
bfTask14.HeaderText = "Task14";
bfTask14.DataField = "Task14";
bfTask14.ReadOnly = false;
GridViewObj.Columns.Add(bfTask14);
BoundField bfTask15 = new BoundField();
bfTask15.HeaderText = "Task15";
bfTask15.DataField = "Task15";
bfTask15.ReadOnly = false;
GridViewObj.Columns.Add(bfTask15);
//We need to add several eventhandlers
GridViewObj.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.GridView1_RowCommand);
GridViewObj.SelectedIndexChanged += new EventHandler(this.GridView1_SelectedIndexChanged);
GridViewObj.SelectedIndexChanging += new System.Web.UI.WebControls.GridViewSelectEventHandler(this.GridView1_SelectedIndexChanging);
return GridViewObj;
}
catch (Exception err)
{
return null;
Loghandling.SchrijfNaarLogfile(false, "frmPlanning3.aspx", "AddGridviewToNewTable", 0, err.Message + " " + err.Source + " " + err.StackTrace.ToString() + " " + err.InnerException);
string strScherm = "frmPlanning3.aspx";
stemp = "frmError06.aspx?Scherm=" + strScherm;
Response.Redirect(stemp);
}
finally
{
}
}
Peter Bellen
bellenp@schneider.com
|
|
|
|
|
Hi fellows, You may have seen printing option, 2 sheets per page on Microsoft Word. Well, if not then these are the steps for what i am talking about are: File--->Print--->Properties. The thing that matters to me is that I have found the exact same options and layout for Print 2 Sheets Per page on Acrobat Reader software. Does microsoft provide those functionality or is it also built by Acrobat. I want to know if I can provide the smiliar options for my small application would be nice. I would appreciated your answers.
Thanks
|
|
|
|
|
Hello,
I've got a combobox that needs to provide the following choices:
choice1
choice2
choice3
I've also got a dataRow with some columns, one of them is called "choice".
I want to do two things, and I believe it is possible to do but I don't quite know how to set this up. First, I want to make the "choice" column update to the selection made in the combobox. Additionally, I want to update the combobox to display the current value in the "choice" column, as it might have changed via another source - assume that there are two displays both providing the same controls and both pointing at the same dataRow. I'm wanting to keep this combobox "in sync" with the choice currently in the dataRow. How do I do this?
Thanks,
Matt
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
For the datarow to change when you select something in the combobox, it's easy, just add some code to the ComboBox.SelectedIndexChanged event.
table.rows[x][y].value = comboBox1.Value
but to do it the other way around, you either have to use events too (f.e. DataTable.RowChanged...) or you can use a timer that checks the datasource for change and updates the combobox.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|