|
If you are trying to remotely control a computer you could use VNC and then try to adapt an open source VNC to your needs.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am a fairly new to .Net application and am assigned a task to create a print functionality from a web application written in C#. Can anybody tell me how to do it?, or direct me a url where I can find information?
|
|
|
|
|
You need to look call window.print(); in a javascript function. For instance <a onclick="window.print();<Print<a>.
|
|
|
|
|
|
Hi Friends,
iam looking c# windows (desktop) application( Not web), browse and upload functionality sourcecode. Please help me - Thanks
|
|
|
|
|
Take a look at the WinForms toolbox in your IDE, i'm sure there's a control that mentions something about Files and Browsing. and a quick google search for file browsing and c# would probably give you tons of examples, mabye even a few articles here. i dont know about everyone here but i've noticed that most of us dont like bieng asked for sourcecode without any evidence that the person asking the question has actually tried to solve the problem, some dont like bieng asked for it even with evidence.
|
|
|
|
|
Hello.
I'm programming a Windows Application which manage data in a MS SQL Server database.
So, I created a DataSet of the database by means of the wizard, and in the "Advanced Options" I checked the followin check box:
Refresh the data table
Adds a Select statement after Insert and Update statements to retrieve identity column values, default values, and others values calculated by the database.
Now, I need to retrieve the identity value of the row I'm inserting.
Which "Select statement" was added in order to get the identity column value after insert a row?
How should I use those statements?
Thank you, in advance.
--
[Adrián Córdoba]
|
|
|
|
|
If i remember correctly it adds whatever select statement it initially uses to the ends of update and insert and delete commands so that the dataSet in memory is always accurate to what is in the database so you can spot errors easily, and you dont have to worry about the dataset saying one thing and the db saying another. You can change the statements, but you have to move the declaration statements out of the InitializeComponent method which is generated for you and put them into the forms constructor or load event. there may be problems with moving them that i havnt found yet..i dont do much with the data once i get it.
|
|
|
|
|
OK.
Please, suppose I just inserted a new row in a datatable with:
myDataSet.myDataTable.Rows.Add(myNewRow)
How can I get the identity column value?
Thank you.
--
[Adrián Córdoba]
|
|
|
|
|
What are you using for your identity column value..is it an auto increment field? I never use auto increment fields, for this reason, i actually have a table called counters that has maybe a dozen or so values that i increment every time i reference them, but i never let the db adjust them on its own, i use a getNextNumber stored procedure that returns the current value and then increments it so its ready for next time. that way i always know what PK i'm dealing with in the code. Or i make the PK derive from something i know so that its never not known or available to me in code or SQL. but anyway, You would have to call the update method on the dataAdapter assoc'd with your dataSet(assuming you are doing it that way) and then go find your new row in the result set it returned..probably the last one, unless you order them differently in your select statement.
|
|
|
|
|
Yes, I used an auto increment identity column.
Thank you very much.
--
[Adrián Córdoba]
|
|
|
|
|
There are several problems with an auto increment column , mostly involves using foreign keys and moving the data around the databse if you ever had to..its always a good idea to control what your keys are and not let something decide for you, then you have to get the new key before you insert so you dont have this problem.. I dont know your data so i cant suggest a good key, but if you're happy with a simple incrementing integer, why not just do table that contains several rows with the id name, its current value, and what to increment it by and use a stored procedure to return the current value then increment it, that way 2 synchrous requests cant duplicat the value...its a little more work but solves a lot of problems now and in the future. onces its set up you can use it all over the place when the data you're trying to store doesnt give you a decent primary or composite key.
|
|
|
|
|
I understood you, but database is already working (in production), so I can't modify it.
Thank you very much.
--
[Adrián Córdoba]
|
|
|
|
|
then the only way i know if is to insert your row then go looking for it in the dataset, if you are using a data adapter. If you are using a stored procedure you could have the SP return the new identity. sorry auto increments make things harder than they should be sometimes.
|
|
|
|
|
Hi every one. I don't know if this is the right section to make this question. So if it isn't sorry
How can I use the click event of the print button on the toolbox of an crystalreportviewer? The problem is that a need to update a field in my database when the report is for the fist time printed.
Thank you all.
|
|
|
|
|
Hi all,
i used this code,but it has this error:{ expected OR } expected in,i bold place of this error occured ,i tried resolve this errors but i couldn't.
public bool ValidateNewUser(string strAlias, string strFirst, string strLast)
{
SqlConnection MyConn = new SqlConnection(ConfigurationSettings.AppSettings["MyOnlineShoppingConnectionString2"]);
SqlCommand MyCmd = new SqlCommand("sp_CheckForDuplicates", MyConn);
MyCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter objParam3;
SqlParameter objReturnParam;
objParam1 = MyCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar);
objParam3 = MyCmd.Parameters.Add("@LastName", SqlDbType.VarChar);
objReturnParam = MyCmd.Parameters.Add("@Duplicates", SqlDbType.Int);
objReturnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = strAlias;
objParam2.Value = strFirst;
objParam3.Value = strLast;
try
{
if (MyConn.State == ConnectionState.Closed)
{
MyConn.Open();
MyCmd.ExecuteNonQuery();
if (Convert.ToInt32(objReturnParam.Value )> 0)
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
else
{
return true;
}
MyConn.Close();
}
catch (Exception ex)
{
lblError.Text = "Error Connecting to Database!";
}
}
}
Please Help Me,
Thank You,
<div class="ForumSig">Hoda </div>
<div class="ForumMod">modified on Monday, May 19, 2008 12:00 PM</div>
|
|
|
|
|
Saba02,
I think you could of solved this your self if you took 2mins to think about it...
public bool ValidateNewUser(string strAlias, string strFirst, string strLast)
{
SqlConnection MyConn = new SqlConnection(ConfigurationSettings.AppSettings["MyOnlineShoppingConnectionString2"]);
SqlCommand MyCmd = new SqlCommand("sp_CheckForDuplicates", MyConn);
MyCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter objParam3;
SqlParameter objReturnParam;
objParam1 = MyCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar);
objParam3 = MyCmd.Parameters.Add("@LastName", SqlDbType.VarChar);
objReturnParam = MyCmd.Parameters.Add("@Duplicates", SqlDbType.Int);
objReturnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = strAlias;
objParam2.Value = strFirst;
objParam3.Value = strLast;
try
{
if (MyConn.State == ConnectionState.Closed)
{
MyConn.Open();
MyCmd.ExecuteNonQuery();
if (Convert.ToInt32(objReturnParam.Value) > 0)
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
}
else
{
return true;
}
MyConn.Close();
}
catch (Exception ex)
{
lblError.Text = "Error Connecting to Database!";
}
}
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Well for starters you have an extra '}' at the end. In Visial Studio (or almost every good text editor) there is a way to match braces, brackets and parenthesis. Give it a shot; you'll find the culprit in no time.
|
|
|
|
|
You should do what I do. If I have a real stumper on my hands, I start writing a message here, but I ALWAYS go back and look a little harder at my code before posting the message. It doesn't always work out, but I have discovered quite a few "stupid programmer tricks" that saved me from having to ask a question.
BTW, your try block starts too late - it really should be around ANY code that can throw an exception.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Good Day,
IF File.WriteAllBytes and File.ReadAllBytes does not have the ability to "return" the progress of the operation, say writing a 1GB file, then what are my other options?
My major concern is to be able to extract the progress of the byte writing/reading since I am working with really large files.
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
Can't you read/write them in chunks of arbitrary size, for example 1mb per chunk?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, that is what I'm hoping to achieve. The "older" way to write files.
But I need some example codes or a link perhaps.
Thank you.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
You can use BinaryReader.Read[^] in a loop, starting with offset 0 until the end of the file is reached, increasing the offset with the chunk size in every loop step.
If you wish I can post an example later (unless you won't find one on google or someone else answers in the meantime), I have to leave right now.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Please do so if you have time. Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
Hello,
Perhaps you can use timer and keep an eye on disk space being consumed...
Like:
1. Have a timer
//do what you want..
2. Get free space in hard-disk you are playing with big files
3. Play with files
in timer tick check free space again, you do know the size of the file right? use these two and check approximately how much work has been done.
HTH!
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|