|
Sorry mate, but you're going to have to write your own converter for them.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I feared as much and have rolled out half the code. I don't really look forward to doing the rest of it tomorrow.
Cheers,
विक्रम
And sleep will come, it comes to us all
And some will fade and some will fall
|
|
|
|
|
Hi Guys. I have managed to get some code to export data in my Access DB to a CSV file. Now, I have two small issues.
1. I want to mark all the records as they are exported to Y in a column named exported and only export all the records marked as N. Anybody have a suggestion on how I could do this in the export code?
2. When I open the CSV file in Excel I get a few errors. First error says that the file is in a different format than the one specified by the extention. It allows you to continue and then comes up with error "Cannot read the 1st record. The it reports yet another error which says that Excel has determined the file to be a SYLK file but not load it" but it still imports the data into Excel. Any ideas on how I get past this?
Code below:
private void toolStripButton2_Click(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(@"C:\nefz.csv", false);
DataTable dt = m_dtCallCentre;
int iColCount = dt.Columns.Count;
for (int i = 0; i < iColCount; i++)
{
sw.Write(dt.Columns[i]);
if (i < iColCount - 1)
{
sw.Write(";");
}
}
sw.Write(sw.NewLine);
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < iColCount; i++)
{
if (!Convert.IsDBNull(dr[i]))
{
sw.Write(dr[i].ToString());
}
if (i < iColCount - 1)
{
sw.Write(";");
}
}
sw.Write(sw.NewLine);
}
sw.Close();
}
I was advised earlier by oneof the guys to go into the DB and run the export from there. This would defeat the pupose of writing code I think so if anybody else can help me out with this then I would greatly appreciate it.
|
|
|
|
|
Is it not the case with respect to 2 that Excel is expecting a comma separated file, but you are using semicolons to delimit the fields?
Regards,
Rob Philpott.
|
|
|
|
|
No mate. In both instances it gives me the same error. Whether I use commas or semicolons it comes up with the same error.
|
|
|
|
|
Hi
How to start service in setup progress
i deploy a setup for service
it's install but service don't start
i should manually start service
finnaly
i would like to start service in installation progress
Thanx
Boroumandan
|
|
|
|
|
Check your last post answer. i have already send it
Check it[^]
|
|
|
|
|
Hi Abhijit Jana
This code Shoud run in application
but i would like that
My Service Start In Setup progress
Note : in setup progress application dosn't start
|
|
|
|
|
r u buid the setup project using .net setup project section !!! then i think it's some diffcult .
but if u can write on your setup program and use that code !!!!
|
|
|
|
|
Hello Everyone,
I'm facing a very different problem.
In my application which is a windows service I need to copy some files from shared network drive which is already mapped for my windows user profile,to local folder.While doing so it gives me an error"Cannot find part of path" but if the same file copy code is used in a simple windows application it works fine and downloads the file.Can anyone help me solve this,can anyone tell me what i have failed to include for a windows service.
Amit
|
|
|
|
|
I think you use Local address
for example
Z:\test.exe
use network address for copy
for example
\\Server\SharedFolder\test.exe
|
|
|
|
|
Actually with windows forms application filecopy works,then why not for the windows service
Amit
|
|
|
|
|
Is your service running under the local account? If yes, it cannot access network paths irrespective of your current login.
You will have to set up your service to use a Windows account that has access to the network path in question.
Cheers,
विक्रम
And sleep will come, it comes to us all
And some will fade and some will fall
|
|
|
|
|
ya thank u very much vikram
i also searched on the web and found 2 rticles which solved my problem completely
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=249102&SiteID=1
&
http://support.microsoft.com/default.aspx?scid=kb;en-us;827421#appliesto
so finally i changed code in installer
SrvPInstaller.Account = ServiceAccount.User ;
SrvPInstaller.Username = "";
SrvPInstaller.Password = "";
and while installing the service it asked me the user id and password where i i/p my uid and pwd which had the rights for that network shared directory
Amit
|
|
|
|
|
Hi friends,
I am using C# in windows based application and i am using one text box in which i want to validate the text box when user enters any Positive Values(+),Negative Values(-) and Decimal Values(.)(only Numeric Values).Can any one send me the code for validating the text box in windows based application using C#.
hemanth@919866357142
|
|
|
|
|
There's at least one article on this site that does that, there's also the maskedtextbox if you prefer. You just handle the keypress event, and set it's handled property to reject keys you don't want. Don't forget to check for Char.IsControl.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Why dont you use "NumericUpDown" control, its what, you want from a textbox
Becoming Programmer...
|
|
|
|
|
Thanks xmen_xwk for your message..but i cannot use NumericUpDown Control here because i want to enter any value in the text box(negative,Positive,Decimal Values from 1 to.... so i cannot specify all these numbers in the NumericUpDown control)..
hemanth
|
|
|
|
|
Use the code below.
Pass the textbox.Text to this method from the validating or validated or leave event of the textbox
public bool IsNumeric(object expression)
{
double retNum;
return Double.TryParse(Convert.ToString(expression), System.Globalization.NumberStyles.Integer,System.Globalization.NumberFormatInfo.InvariantInfo,out retNum );
}
Thanks,
Srikanth
|
|
|
|
|
Thanks Srikanth for your code.i tryed it but i didn't get the correct result from your code.can u send me the project file which you did to my mail id .I will check it out..my mail id is g.hemanth17@gmail.com
Thanks,Hemanth
|
|
|
|
|
buddy you can also write any value in NumericUpDown
Becoming Programmer...
|
|
|
|
|
hi!
i have used this chunk of code for taking only positive decimal and interger values, it worked successfully for me. you can modify it according to your need. it is basically keypress event of textbox...
private void onKeyPress(object sender, KeyPressEventArgs e)
{
char[] myNum = new char[12] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '\b','.' };
bool blnNumFnd = false; //for keeping track of decimal
foreach (char c in myNum)
{
if (e.KeyChar == myNum[11])
{
String txt = ((TextBox)sender).Text;
if (!txt.Contains("."))
{
blnNumFnd = true; //means its decimal value and user can't enter another decimal again!
break;
}
}
else if (e.KeyChar == c)
{
blnNumFnd = true;
break;
}
}
if (!blnNumFnd)
e.KeyChar = '\0';
}
hope it will work for you!
Regards,
shazjazz
|
|
|
|
|
Thank you shazjazz..its helped me out...
<marquee>hemanth
|
|
|
|
|
Hi Shanjazz can u send me the code for entering Positive values and negative values also..i tryed by changing the code but i didn't get the result correctly.I am waiting for your code for entering Negetive,Positive,Decimal values in textbox
hemanth
|
|
|
|
|
I created a grid which shows categories. I want to add paging to grid showing only 10 categories for each page.
According to requirement, first categoryid column of grid must be invisible. And want to replace y with yes. To achieve this I have written code as below
protected void gdViewCategory_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
e.Row.Cells[1].Visible = false;
if (e.Row.Cells[4].Text == "y")
e.Row.Cells[4].Text = "Yes";
if (e.Row.Cells[4].Text == "n")
e.Row.Cells[4].Text = "No";
}
}
And to add paging I have written code as below:
protected void gdViewCategory_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gdViewCategory.PageIndex = e.NewPageIndex;
BindData();
}
It displays required result, but the header of gridview shows all column names.
And therefore row data is not under right columns.
|
|
|
|