|
Megidolaon wrote: This is confusing me, because I thought lock actually blocks other threads. However that is apparently not the case.
No, the lock doesn't lock other threads, it only locks other locks. As you only have one block of code that is locked, the lock has no effect.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
First of all, i wrote execly the same Subject yesterday but i didnt understand the answer..
i want to add a new row to specific MDB file...
my code is:
string connectionString = "provider=Microsoft.JET.OLEDB.4.0; " + "data source =" + Dir;
string commandString = "Select id,Event from Events";
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(commandString, connectionString);
DataSet ds = new DataSet();
dataAdapter.Fill(ds, "Events");
DataTable datatable = ds.Tables[0];
DataRow newRow = datatable.NewRow();
newRow["id"] = "aaa";
newRow["Event"] = "bbb";
datatable.Rows.Add(newRow);
dataAdapter.Update(ds, "Events");
ds.AcceptChanges();
Application.DoEvents();
i did this code but it pop a exception:
"Update requires a valid InsertCommand when passed DataRow collection with new rows"
What i need t do? and where?
thank you very Much
G.
modified on Thursday, July 31, 2008 3:59 AM
|
|
|
|
|
Admin887 wrote: i did this code but it pop a exception:
"Update requires a valid InsertCommand when passed DataRow collection with new rows"
What i need t do? and where?
You need to provide an insert command. Read some of the documentation to understand how it works.
|
|
|
|
|
check that u have written the dataadapters insert command properly with correct parameters
rahul
|
|
|
|
|
Hi Everyone,
I ve one desktop project in c#.
I ve created its setup project in same solution and in that i added a dialog box and used custom action to accept and verify the serial number from the user.
Everything works fine. If invalid serial number is entered then at the end it gives "Invalid Serial" error and installation rolled back. Its all that i want.
But.. after a successful installation when again click on Setup.exe and it ask for two options. Repair or Remove.
While Repairing it gives "Invalid Serial" error.
I want it to be repaired properly.
Any solution for this .....
Regards,
-SIFAR.
|
|
|
|
|
Sifar - 0 wrote: While Repairing it gives "Invalid Serial" error.
So, attach a debugger and find out why it is being called!
|
|
|
|
|
So in an MSI sense you have a custom action in the InstallUISequence which accepts (per dialog) and validates a serial number. But what does "verify" mean? Do you set a variable which is checked in another action?
In repair mode your serial number dialog is not shown, right? So verification must take place somewhere else. Maybe you can give further details here.
Or try http://www.installsite.org/[^]. If you have to do more setup custom action stuff it may be worth registering with the forum there.
|
|
|
|
|
i have created a win forms and try to connect it to my database.my problem is that there are 3 warning which i can't understand.my code and warning list are below:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace sts
{
public partial class Voucher : Form
{
SqlConnection cn;
public Voucher()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{ string connectionString = "Data Source=RYANS-27F187045\\SQLEXPRESS;Initial Catalog=msdb;Integrated Security=sspi";
cn = new SqlConnection(connectionString);
cn.Open();
SqlCommand cmd = cn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "insertv";
cmd.Parameters.Add(new SqlParameter("@Id_No", SqlDbType.Int));
cmd.Parameters["@Id_No"].Value = txtId_No.Text;
cmd.Parameters.Add(new SqlParameter("@NAME_OF_ACCOUNT", SqlDbType.VarChar, 50));
cmd.Parameters["@NAME_OF_ACCOUNT"].Value = txtNAME_OF_ACCOUNT.Text;
cmd.Parameters.Add(new SqlParameter("@QUANTITY", SqlDbType.Float));
cmd.Parameters["@QUANTITY"].Value = txtQUANTITY.Text;
cmd.Parameters.Add(new SqlParameter("@PRICE", SqlDbType.Float));
cmd.Parameters["@PRICE"].Value = txtPRICE.Text;
cmd.Parameters.Add(new SqlParameter("@TOTAL_AMOUNT", SqlDbType.Float));
cmd.Parameters["@TOTAL_AMOUNT"].Value = txtTOTAL_AMOUNT.Text;
cmd.Parameters.Add(new SqlParameter("@DATE", SqlDbType.DateTime));
cmd.Parameters["@DATE"].Value = txtDATE.Text;
cn.Close();
}
private void Voucher_Load(object sender, EventArgs e)
{
string connectionString = "Data Source=RYANS-27F187045\\SQLEXPRESS;Initial Catalog=msdb;Integrated Security=sspi";
cn = new SqlConnection(connectionString);
}
private void txtVoucherc_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void txtDATE_TextChanged(object sender, EventArgs e)
{
}
}
}
Warning 1 Invalid search path 'C:\Program Files\DevStudio\DF\IMSL\LIB' specified in 'LIB environment variable' -- 'The system cannot find the path specified. ' sts
Warning 2 Invalid search path 'C:\Program Files\DevStudio\DF\IMSL\LIB' specified in 'LIB environment variable' -- 'The system cannot find the path specified. ' sts
Warning 3 Invalid search path 'C:\Program Files\DevStudio\DF\IMSL\LIB' specified in 'LIB environment variable' -- 'The system cannot find the path specified. ' sts
|
|
|
|
|
It has nothing to do with your code (the above code). Check your project/solution settings.
|
|
|
|
|
Hi all how can i resduce the hight of a form by x amount at run time while loading the form
thank for youe help
vikas da
|
|
|
|
|
on load you ahve to write
this.size = new Sysytem.Drawing.Size(this.width,x)
x is the new height.
Be Happy
Syed Shahid Hussain
|
|
|
|
|
Thank you ver much for ur reply ...
am using following piece of code but mo luck ..
MessageBox.Show("No value in first text box");
panel2.Visible = false;
panel3.Location = panel2.Location;
panel5.Size = panel5.Size - panel2.Size;
int hight=this.Size.Height -panel2.Size.Height;
this.Size = new System.Drawing.Size(this.Width,hight);
here am trying to eliminate the space left after hiding a panel2
vikas da
|
|
|
|
|
What u want now?
Any thing wrong in it? Give me ur problem detail.
Syed Shahid Hussain
|
|
|
|
|
I dig out why it was not working ...
a form can be resize to have biger size then earlier ... and cant be risize to smaller one
vikas da
|
|
|
|
|
your code is perfect and am using the same ... but can use to increase the size of the form only .. it cant be used to reduce the size of form ..
Thank you very much for your reply ...
vikas da
|
|
|
|
|
My pleasure, Welcome for more assistance,
Be Happy
Syed Shahid Hussain
|
|
|
|
|
Hi,
I am trying to create a CPU Usage monitoring application. I am using PerformanceMonitor to do it. However as I was observing the data from Task Manager's CPU Usage column (Process Tab) and Performance Monitor (Process - % Processor Time) readings, they don't seem to coincide at all (Not even close). I tried to change the Performance Monitors sampling interval, but I can't seem to make the 2 coincide.
Does anyone, know why the readings are different?
Thanks.
SDE
|
|
|
|
|
|
Thanks.
SDE
|
|
|
|
|
Hallo to all.
I do not know if this is possible, but it is worth a try.
I am currently integrating with a module from Accpac. By using the dll's. The data you insert through the dll is very specific. If i run the macro generated from Accpac, it will return a message to me. eg. The invoice nr have been used. But when the error is in c# i just get a Com Exception.
I want to be able to get the message from the dll, to show as exception in C#..
Help ?>
Thanks in advance.
Vendetta
|
|
|
|
|
If it's not in the inner exception, or the COM error code, then it's not being passed to you.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
So there is no way I can fetch it then...damn
Vendetta
|
|
|
|
|
I´m trying to create .txt files with iso-8859-2 encoding, but I have problems with some of the characters from the charset. They don´t display correctly in the file.
Here is my code sample that I use to create the files:
File.WriteAllText(filePath, fileContent, Encoding.GetEncoding("iso-8859-2"));
Can anyone help me with this?
cellardoor
|
|
|
|
|
That looks perfectly fine.
What are you using to display the file? Does the encoding actually support the characters that you write to it?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|