|
This error may occurs when the object is not inilized.
Use this:
myClass myObject = new myClass();
OR
myClass myObject = null;
myObject = new myClass();
|
|
|
|
|
ZeeshanAhmedpk wrote: myClass myObject = null;
myObject = new myClass();
Why this?
|
|
|
|
|
Its null reference because you havent instantiated or assigned to an instance.
Why it throws an exception is because you using even though it is null reference.
Hope this answers your question..
.NET Rules
|
|
|
|
|
myObject = new myClass();
But you have assigned myObject to an instance...
|
|
|
|
|
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
|
|
|
|