|
Thanks, it worked great.
Tina_K
|
|
|
|
|
hi
Iam using report viewer to generate reports.But with the following error.what is this and how can it be solved.
"An error has occurred during report processing.
Exception has been thrown by the target of an invocation.
Object reference not set to an instance of an object."
And i cannot debug to see the expection can any one help out.
Thanks.
|
|
|
|
|
Hi
This link may help you to learn all about report viewer
www.gotreportviewer.com
Thanks & Regards
|
|
|
|
|
Hi,
I'm building an application for versioning purpose.
Though this versioning system is different from our regular software versioning applications like WinCvs, VSS etc (as my versioning system has more of the domain essence to it), the basic architecture would still remain same.
There is our client application containing some versionable elements, from which we trigger new versions, which would be stored in a repository at a server.
Here I'm stuck with the communication channel. I've figured out 2 ways of doing it
1. Using sockets
2. Remoting
Primarily there is only transfer of files involved between the client and the server.
I'd like to know which is the better way to go about it.
Also is there any other approach apart from remoting and sockets to form a client - server app with this kind of requirements?
Thanks in advance
Naren
|
|
|
|
|
OK. Remoting also uses 2 types of channels TCP and HTTP for communication and both are sockets.
As you specified if just File Transfer is involved then you should use the Socket to avoid some complex programming. but using Remoting you will have more control over it. i.e. calling a method or invoking a event at the server. so think about the functionality of the application and decide it.
Socket is more simple to implement over Remoting
and
Remoting has much more control and security over Socket.
|
|
|
|
|
I cant make a full dynamic query in LINQ
I have 2 situation methods (only_exp_query, only_tbl_query) those are working.
...
using System.Linq.Dynamic;
using System.Data.Linq;
...
string connString = @"Data Source=.;Initial Catalog=Northwind;Integrated Security=True";
DataClasses1DataContext db = new DataClasses1DataContext(connString);
...
private void only_exp_query()
{
var query = db.Customers
.Where("City=@0", "LONDON")
.OrderBy("CompanyName");
dataGridView1.DataSource = query;
}
private void only_tbl_query()
{
Table<customer> _customer = db.Customers;
var query = from tbl in _customer
select tbl;
dataGridView1.DataSource = query;
}
But i want to run the script below , but it is not working...
private void full_query()
{
var query = db.GetTable("Customers")
.Where("City=@0", "LONDON")
.OrderBy("CompanyName");
dataGridView1.DataSource = query;
}
and then i can try this below script...
private void full_query()
{
Assembly asm = Assembly.GetAssembly(typeof(DataClasses1DataContext));
var query = db.GetTable(asm.GetType("Customer"));
.Where("City == @0 and Orders.Count >= @1", "London", 10)
.OrderBy("CompanyName, City")
.Select("New(CompanyName as Name, Phone)");
dataGridView1.DataSource = query;
}
but it returns the following error:
"ArgumentNullException was unhandled ,Value Cannot be null,Parameter Type"
but i dont know this error.
WHAT CAN I DO?
can you help me please
|
|
|
|
|
mucahit wrote: but it returns the following error:
"ArgumentNullException was unhandled ,Value Cannot be null,Parameter Type"
but i dont know this error.
That is caused by: asm.GetType("Customer")
So make sure that value returned is not null.
|
|
|
|
|
first of all, thank you for help.
it is possible,
but what can i do this error message?
What can i do full dynamic query in LINQ?
|
|
|
|
|
The problem was solve
thats;
we can change this rows
Assembly asm = Assembly.GetAssembly(typeof(DataClasses1DataContext));
var query = db.GetTable(asm.GetType("Customer"));
new row
Table<customer> _customer = this.Context.GetTable( typeof(Customer) ) as Table<customer>;
thank you, leppie
|
|
|
|
|
How to Identify Smart card reader on PC?
Which API should be used to pick data from these readers.Can you give me small example or link?
Thanks in Advance.
|
|
|
|
|
I have two factory classes that both return a generic list of a data object class. Currently the code is using a switch statement to call a particular factory depending on some input. Code below the switch statement below depends on getting the list of data objects from different sources, but processing them the same.
List<Product> products = null;
switch (i)
{
case 1:
products = ProductFactory.GetProducts();
break;
case 2:
products = ItemFactory.GetItems();
break;
default:
break;
}
The problem is that if I want to add more factories from different sources... I would have to rewrite the code for the current builder class, i.e. add more statements to the switch. Since an unknown number of factory calls could be made to get the data objects from different sources (one factory returns from Oracle, one from SQL one from SAP, etc) the code needs to accommodate any new factory sources without having to recode.
Is there an easy way to accomplish this, please show me some sample code if there's a way to do so.
Thanks
-----------------------------
If you don't go after what you want, you'll never have it.
If you don't ask, the answer is always no. If you don't step
forward, you're always in the same place. -Nora Roberts
|
|
|
|
|
I guess you need a FactoryFactory.
Like you 'lookup' them by index now, just place it in a list (array), and lookup the index.
|
|
|
|
|
Hi there, I'm not sure if I followed what you meant here? Could you perhaps show me some sample code? I'd really appreciate it!
-----------------------------
If you don't go after what you want, you'll never have it.
If you don't ask, the answer is always no. If you don't step
forward, you're always in the same place. -Nora Roberts
|
|
|
|
|
sam L wrote: Hi there, I'm not sure if I followed what you meant here? Could you perhaps show me some sample code? I'd really appreciate it!
Something like:
Factory[] factories = { new AFactory(), new BFactory(), etc };
int index = ??;
Factory f = factories[index];
List l = f.GetList();
|
|
|
|
|
Thanks a lot for the sample code...I guess the indexer here would be numbered based, so I can initialize the int index = 0??? But how is it going to get incremented for the subsequent factory values (AFactory, Bfactory, etc)????? Should there be a loop???
Can you please clarify?
-----------------------------
If you don't go after what you want, you'll never have it.
If you don't ask, the answer is always no. If you don't step
forward, you're always in the same place. -Nora Roberts
|
|
|
|
|
It's your code, you should know what it does. If you are not familiar with the pattern you are using, please read up on it.
Your 'indexer' (key really) can be based on anything if you use hashtables instead.
Lastly, why do you want to loop? Do you want to combine the data maybe? Then do that after you got the data. Solve one problem at a time.
|
|
|
|
|
You can add your object into hash table.
Then you can use has code value in the switch statement.
|
|
|
|
|
dibya_2003 wrote: Then you can use has code value in the switch statement.
That is exactly what you should not do! You simply look it up by the key, without the need for a switch.
|
|
|
|
|
I am not sure I got your question. How about something like this ?
class Program
{
static void Main(string[] args) {
List<Product> sapProducts = ProductFactory.GetProducts(new SAPFactory());
List<Product> oracleProducts = ProductFactory.GetProducts(new OracleFactory());
}
}
abstract class BaseFactory
{
public abstract List<Product> GetProduct();
}
class SAPFactory : BaseFactory
{
public override List<Product> GetProduct() {
return new List<Product>();
}
}
class OracleFactory : BaseFactory
{
public override List<Product> GetProduct() {
return new List<Product>();
}
}
static class ProductFactory
{
public static List<Product> GetProducts(BaseFactory factory) {
return factory.GetProduct();
}
}
This allows you to add new factories easily without modifying any code. You can keep the factory names in a XML file and load it at runtime using reflection which gives you full flexibility on adding new factories.
Is this what you are looking for ? Correct me if I got you wrong.
|
|
|
|
|
hi all,
actually we developed windows application using (Visual Studio 2008 C# & LINQ and sqlserever 2005 express edition).and i have to create setup and deployment for this project. i was added new project as "setup and Deployment" for my windows project .And i also included all the prerequisites to my project.exe layer.but main problem is "How can i deploy the database in Client machine ".
i tried this in client Machine :
it was installing All the Prerequisites in Client machine ,it was runnig succcesfully ,but it was showing "user is not trusted user" ,How can i solve this ,could u please help me,and i was strucking from last 3 weeks.
i got the below error:
============================
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.
<configuration>
<system.windows.forms jitDebugging="true"/>
</configuration>
When JIT debugging is enabled any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.
=============================
i tried this, but it is not working ,it was showing bellow error message
" Login Failed for user .The user is not associated with a trusted Sql Server Connection ",main thing is i want to deploy the database in client Sql server . And how can i do this ,could u please help me .
Thanks in advance
|
|
|
|
|
this is only required if you have installed Express Edition.
Open "SQL Server Management Studio Express
Connect to your Database
Right Click on the Database in Object Explorer
go to Properties
select "Security"
Now in Server Authentication Mode
select "SQL Server And Windows Authentication Mode"
Restart the SQL Server Service (if you dont know how then restart the computer)
if still have the problem then
go to
Start
SQL Server 2005
Configuration Tools
SQL Server Surface Area Configuration
Then select "SQL Server Surface Area Configuration for Service & Connection"
now select "Remote Connection"
tick on "Remote and Local Connection"
again tick on "Use Both TCP/IP and Named Pipe"
Now go to Service "Stop" it and then "Start" it.
also its not advisable to use "sa" user at deplyoment (client side).
create one database user and give it specific rights
there are 2 ways
either you specify the sql script at the deployment project, or you can run set of sql commands from the application, if the application cannot connect to specific database in sql server (for this you have to connect to the sql server using Windows Authentication mode).
|
|
|
|
|
Hello all,
I've been assigned a bug in a multi-threaded windows application method that serves lookup data. The method fills a static list object full of simple data objects. When only one thread hits the method the method executes rapidly. The SQL stored procedure that is returning the results is optimized and runs quickly. You can test it using a T-SQL call and it runs in less than a millisecond. When one thread accesses the method the code returns just as quickly. But when more than one thread hits the method at the same time load up of the static list object becomes slower in an exponential fashion, driving system resource usage up and taking much longer than expected. After the list runs then the usage drops again, since the method is no longer called until the application is recycled.
private static List<DataObject> _list = null;
public static List<DataObject> GetList()
{
if (_list == null)
{
_list = new List<DataObject>();
SqlDataReader reader = null;
SqlConnection connection =
new SqlConnection(ConnectionString);
SqlCommand command = null;
// Set up a new command
command = new SqlCommand("GetList", connection);
command.CommandType = CommandType.StoredProcedure;
reader =
command.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read())
{
DataObject instance = new DataObject();
instance.ID = reader["ID"] != DBNull.Value &&
reader["ID"] != null ? (int)reader["ID"] : 0;
instance.Name = reader["Name"] != DBNull.Value &&
reader["Name"] != null ? (string)reader["Name"] :
string.Empty;
_list.Add(instance);
}
}
}
Please help me out here, I'm not sure what is causing this behaviour??? Is there something in the code that needs to be fixed???
I'd really appreciate it!
Thanks
Tina
|
|
|
|
|
Tina P wrote: But when more than one thread hits the method at the same time
Are multiple threads trying to populate the list at the same time? Try locking
MSDN Locking
hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hello Bob,
I think that is precisely what's happening...i looked into locking a little bit, but I can't quite figure out where to put the lock statements and where to unlock? Would you be able to point me in the rite direction and perhaps show me some code? I'd really appreciate it!
Tina
|
|
|
|
|
i think that the list being static is the bottle neck...
static means "only a single copy of that member can exist at any given time, regardless of how many copies of a class are instantiated".
what i think is happening is thread A, B and C start the method 1ms after each other for arguments sake. let say the method takes 1000ms to complete.
thread A will get access to that static object but B and C will have to wait for A to finish its work with it before B and C may access it. so you expect 1000ms for the three threads to complete the task but now that they have to wait for each other its taking 3000ms.
im not sure if im right but its what makes sense to me, hope it helps
BTW, please use PRE tags when posting code... no one wants to read non-indented code
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|