|
Hi,
I have a server database and multiple client databases.
We need to update client databases everytime server database is updated.
And we need to do it using .Net i.e through the application server.
We intend to use ftp for file transfer and windows services to schedule it.
We have a batch file(dos-script) which reads from the flat file and updates the local database.
I need some help regarding running the batch file from windows services(using C#).
Can you suggest any way to do it as i am completely clueless now....
Thanks in anticipation....
|
|
|
|
|
Process.Start("yourbatchfile.bat");
|
|
|
|
|
who can tell me, how I can export a pdf-file to a SharePoint documentlibrary with C#?
I create with MS-Access a lot of turnoverlists every month. These lists are to be exported in differently documentlibraries.
I have a textfile with all pdf-files with name from link, name of documentlibrary and name from pdf-file (delimiter = ; ):
http://localhost;VB1;Dokumente;b:\CustVB1200603.pdf;"customer.pdf".
With C# I read the textfile and then...?
-- modified at 3:49 Wednesday 5th April, 2006
|
|
|
|
|
I am using Microsoft Patterns and Practices Enterprise Library Data Access Block. I have called a function which returns an object of type IDataReader. It has only single row in it.
I am writing this code
IDataReader dr =db.ExecuteReader(cmd);
string CityName = dr.GetValue(0).ToString();
On running this code I am getting the exception as
InvalidOperationException: Invalid attempt to read when no data is present.]
System.Data.SqlClient.SqlDataReader.PrepareRecord(Int32 i)
System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
But when I add two lines of code in it which has nothing to do with the running code, I don't get any exception. The code is as
IDataReader dr =db.ExecuteReader(cmd);
if (dr.Read()==true)//yaha kuch gadbad hai
{
int mkio =0;
}
string CityName = dr.GetValue(0).ToString();
Why this problem is happening and why it is not occuring when i add code which has nothing to do with the results.
Thanks,
Sandy
|
|
|
|
|
|
When you first get an instance of IDataReader, its position is set before the first row. So any attempt to read a value will cause the error you saw.
The corrrect way to use a datareader with a single row is
if(dr.Read())<br />
{<br />
}
or for a datareader with multiple rows
while(dr.Read())<br />
{<br />
}
the reason you stopped getting the error, is because you inadvertantly added a Read() command
|
|
|
|
|
When i put a control on a MDIParent form , every child form opens behind this control.
How can i handle this problem ?
Thank you in advanced.
|
|
|
|
|
hi,
i have to stop the load of my form when i catch an error,
i want to close the form.
but if i write:
try
{
...
}
catch
{
Close();
}
i get an error. because it's impossible to close form on load.
someone has any ideas? how can i stop the load?
thanks a lot. Cliffer
|
|
|
|
|
I don't know it if is what you really need... but try this.
private void mdi_Load(object sender, System.EventArgs e)
{
try
{
throw new Exception ( "Error" );
}
catch
{
this.Closing += new CancelEventHandler(mdi_Closing);
OnClosing( new System.ComponentModel.CancelEventArgs ( false ) );
}
}
private void mdi_Closing(object sender, CancelEventArgs e)
{
System.Windows.Forms.Application.Exit ();
}
Hope It works
Ricardo Casquete
|
|
|
|
|
Hi
You don't say how you are showing the form.
If you are showing it using ShowDialog , you can just set the DialogResult property:
private void Form2_Load(object sender, System.EventArgs e)
{
try
{
...
}
catch
{
DialogResult = DialogResult.Abort;
}
}
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
Can anyone tell me how to gain control of the web page after response.end()? I am generating a dynamic excel sheet and to render it to the client I am using response..end , but I am left with a blank window. This is because the thread aborts after response.end and I have no control over the popup. Has anyone seen this problem with gmail tooo? Try downloading the attacment. This is the probelm I am facing too.
Any solution?
|
|
|
|
|
here is my code for download page:
private void Page_Load(object sender, System.EventArgs e)
{
Response.Clear();
Response.ClearHeaders();
Response.ContentType="application/octet-stream";
Response.AddHeader("Content-Disposition","attachment; filename=\"" +FileName + "\";");
Response.AddHeader("Content-Length",((byte[])Attachement).Length.ToString());
Response.WriteFile(FileName);
Response.Flush();
Response.Close();
}
if your window still keep opened, you can try to use hiden frame:
like this:[a href='download.aspx?file=xxxxx' target='hideframe']download[/a]
Hope this can help you.
-- modified at 4:10 Wednesday 5th April, 2006
|
|
|
|
|
Hi Experts
How can i get the keyboard keystroke values before it going to OS using C# ? Is it possible to change that keycode and send another one to OS ?
Thanks and Cheers
|
|
|
|
|
|
hi every body , i have problem
i cant find any helpfull algorithm about hamming code(for detecating & correction errors when some spicefice data had been sent between servers) so
any info. about this subject will help .
and thanks.,and how to convert from character to binary in c#
chawo
-- modified at 6:45 Wednesday 12th April, 2006
|
|
|
|
|
hi all,
My business layer contains 1 object per table in my
database. Object properties are the same as table fields.
I get a dataset with 1 row back from my database when I
instantiate my objects. Is there a way to load this dataset
into my object properties (fields)? without having to
traverse and match the nodes on the dataset to my properties?
this way, I can use the same method for all my objects AND
I dont have to worry about the function if I change my object
or table.
any ideas?
thanks
M
|
|
|
|
|
Hi
You could use reflection for this.
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
how? is there an example somewhere out there?
|
|
|
|
|
In a windows application(C#) I am working on,I have 5 threads accessing data from a table and running one after another.I want to lock data for each thread when it is accessing data ,so I have used "for update" in my select statement but it doesn't work.Every thread when accessing data sets one flag in the table so that other threads should not select this data again,but some times 2 or 3 threads access the same row .Any help to lock the rows please.
Thank you.
|
|
|
|
|
The time we have to did this, we have to create anhoter table in the database with information about the tables or rows locked.
I mean.
One Method to lock
Lock ( string TableName )
Lock ( int[] RowsIDs )
UnLock ( string TableName )
UnLock ( int[] RowsIDs )
Write this info in a table, and when the data is queried to the database do a Join with the rows of this table.
Also we add a delay of 5 minutes to set free the rows, because someone can forget the UnLock.
Regards
Ricardo Casquete
|
|
|
|
|
How draw formatted text in cell DataGrid
e.g. This text have different format Font
------------
piotrbla@poczta.fm
|
|
|
|
|
simply use the e argument of Cell_Formating event of your grid.
|
|
|
|
|
Use DataGridView control...
It is more powerfull then usual DataGrid...
|
|
|
|
|
Is there any way to make property grid values color changed in some
cases based on certain scenarios. I only wanted to change right side
values of some grids in property grid. Is there is any way to do this
plz let me know it( whether it is reflection or any other thing ). Also
another issue to make property grid readonly which i dont think any
body know.
Thanx in advance..............
|
|
|
|
|
You can.
There easier way in my opinion is to add the code for formating the cells in the Item_DataBound method.
In the Item and Alternate Item, do a loop to iterate for the cells of the Row and Set the Style you want
Ricardo Casquete
|
|
|
|