|
Hi..
The exception only get thrown were you use the null reference, can you post the code, and give the line num that tthrows the exception.
Maybe we can see what you really trying to do.
.NET Rules
|
|
|
|
|
hi.
my error got rectified, that was because i had used transactions and missed out to assign the transaction property for the command object.
regards
-----------------------------------------------------------------
where there is a will there is a way
|
|
|
|
|
how to post my articles onto this forum?
|
|
|
|
|
You dont post articles to the forums. You submit them to CodeProject. Hover your mouse over the Articles menu, and select Submit an Article.
|
|
|
|
|
HI,
How can i programmatically restart SQL Server 2005 express edition? Any sample code,link, help etc.
Regards,
Wasif Ehsan.
|
|
|
|
|
Look at the ServiceController class in System.ServiceProcess.dll
|
|
|
|
|
Regex r = new Regex(@"[^t^\s^\d^x^X]|[^d^\s^\d^x^X]", RegexOptions.IgnoreCase|RegexOptions.Compiled);
what does this regular expression means
|
|
|
|
|
sarojkumarjena wrote: what does this regular expression means
I suspect an error, all those '^' are wrong (except the 1st 2 occuences). But here's the break down:
Match one character of ( (anything but t, ^, whitespace, number, x, X) or (anything but d, ^, whitespace, number, x, X) ).
See, its totally 'stupid'.
Do yourself a favour, and learn RegEx, much easier to write than to read IMO
|
|
|
|
|
int i=20;
How shall I show a value of i in message box
|
|
|
|
|
MessageBox.Show(i.ToString());
|
|
|
|
|
In order to show the value of i, you can use following:
MessageBox.Show(i.ToString());
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi
I am developing Windows Mobile Application using c#, SQLLite DataBase,I am using .NETWrapper for SQLLite, Iam able to Create Tables, but I wanted to create only once,How to check whether the Table is already created?
I didnt find any samples in Website.
Please help me
Thanks
|
|
|
|
|
Try "Select Count(*) from Mytable"
If you get an exception (or no such table error) then create it, if it succeeds, then move on to the next table.
|
|
|
|
|
Thanks for your prompt reply, I will try it out.
|
|
|
|
|
Use Transact SQL..
Something like.
IF 'USERS' NOT EXIST THEN CREATE TABLE ( ... )
Hopes his helps...
.NET Rules
|
|
|
|
|
|
Sorry.. typo mistake
'USERS' is the table..
Also if you are using an ms sql db, then you can also do something like this
IF EXISTS (SELECT 1
FROM sysobjects
WHERE xtype='u' AND name='tablename')
--- 'tablename exists.'
ELSE
--- 'tablename does not exist.'
Dropping Table
DROP TABLE SALARY IF EXIST
then create it again
CREATE TABLE SALARY ( ... )
There are many ways to solve what you are trying to do..
.NET Rules
|
|
|
|
|
I am writing code that will synch 2 databases. This process can take time and I want the ability cancel the process once it is started. The process is started by the timer when a dialog box is opened. The dialog box has a cancel button, but it doesn't work even if I DoEvents() on the next update of the progress bars. Is there a way to attach a Listner or something that does not require creation of second thread? The biggest issue is that a couple of the database calls can result in blocking while it waits for results. By the way, if this has been answered before sorry, I tried several queries and could have missed the necessary queries. Thanks.
Leo T. Smith
|
|
|
|
|
If you are using 2.0 then simple create a backgroundworker and enable AllowCancel. Have this start rather than the timer when the form is loaded.
If you are not using 2.0, WHY NOT!!!
Seriously, if you can't use 2.0 then you have to do the hard work of creating a thread and stopping the sync. Sorry but creating a seperate thread to run it is the only way to get the functionality while remaining responsive the the UI.
only two letters away from being an asset
|
|
|
|
|
Hi all, using this code I hoped that the phone nuber would show up formatted but it is not for some reason, it still shows unformatted. The numberComboBox is a Winform combo box that is part of a custom control. Everything works well except for the formatting. I also tried "0: (###) ###-####" as the format string but no go! The UnFrmtPhoneNumber member is a string column containing unformatted numbers like 5145555555.
Anyone knows why ?
Thanks for any help
public BindingSource Binding
{
set
{
numberComboBox.DataSource = value;
numberComboBox.DisplayMember = "UnFrmtPhoneNumber";
numberComboBox.ValueMember = "PhoneID";
numberComboBox.FormattingEnabled = true;
numberComboBox.FormatString = "(###) ###-####";
}
}
|
|
|
|
|
That depends on the data type of the phone number. If it's a string, then supplying a FormatString will do nothing because it only works with numeric values, not strings. If the phone number is stored as an Integer, it'll work just fine.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok I am working with the 2.0 Framework and I have a Windows Form with 2 DataGridViews. When a Row is Selected in both GridViews and a Toolbar Button pressed I am assigning Data From one to the other and vice-versa. I have the SelectionMode set to FullRow Selection.
Here is where the problem comes into play, if I update without the user moving the selected row in both datagridview controls the update doesnt see that anything has been modified. I have tried calling EndEdit on the GridView, but since the user didnt edit the Cell (I do with code), this doesnt make a difference. Is there a way to force the GridView to post its current changes so the Underlying DataTable thinks its been modified?
Thanks in Advance
Terance Emory
|
|
|
|
|
Ok figured it out in case someone else runs across this problem. I personally dont think there is a way to make a row accept changes without physically moving off the row. So what I did instead is update the underlying DataTable.
This might be a bit of a hack (meaning might be better way to do this), but all I did was pull the key values from the current row using a DataView I locate the DataRow in the DataTable and modify the value there instead of in the cells of the DataGridView. Worked like a charm.
I cant believe something so simple is so hard with this control, give me a method to tell the GridView "Hey Foo, this row is Dirty".
|
|
|
|
|
Hi guys;
I have a question; I am using SQL dataadapter to run a stored procedure of which I am filling the result into a dataset as follows:
DataSet ds=new DataSet();
adp.Fill(ds,"tbACJE");
then I am running the following code:
if(ds.Tables["tbACJE"].Rows.Count>1)
{
What I would like to do from there is to find/compare the sum of 2 columns. i.e CreditColumn and DebitColumn. Could you guys help me on how I could do that please.
Thanks in advance.
sasa
|
|
|
|
|
ds.Tables["tbACJE"].Compute("SUM(Credit + Debit)", "<filter>");
only two letters away from being an asset
|
|
|
|