C# .NET - error
Asked By Judy Lim on 16-Nov-11 01:13 AM
I'm having this error -
DataTable1 dt = new DataTable1();
Error 7 The type or namespace name 'DataTable1' could not be found (are you missing a using directive or an assembly reference?)
Can someone tell me where I had done wrongly?
Jitendra Faye replied to Judy Lim on 16-Nov-11 01:14 AM
Change like this=-
DataTable dt = new DataTable();
Judy Lim replied to Jitendra Faye on 16-Nov-11 01:15 AM
Error 6 The type or namespace name 'DataTable' could not be found (are you missing a using directive or an assembly reference?)
Reena Jain replied to Judy Lim on 16-Nov-11 01:16 AM
Hi,
check the line with this
DataTable dt = new DataTable();
means you are create a variable of datatable in the name of dt and initializing the dt with datatable
aneesa replied to Judy Lim on 16-Nov-11 01:17 AM
Add Namespace
Using system.Data;
and ur declaration
DataTable dt=new DataTable();
C D replied to Judy Lim on 16-Nov-11 01:18 AM
Hello,
There is not any Class DataTable1 in System.Data Class
You need to display DataTable insetad of DataTable1
Hope this helpful
Web Star replied to Judy Lim on 16-Nov-11 01:20 AM
You need to do two things one is change your code as, actually DataTabe are class you are wrting misspelling DataTable1 that why you are getting error
DataTable dt = new DataTable();
One more thing you should using valid namespace of DataTable before using it
sp put on top of the page as
using System.Data;