|
hey guys
does anyone know what the newline char is for MS-SQL2000?
i need to be able to INSERT it in a text column from my front end, and view it on a DataGridView and crystal reports...
i googled but didn't find anything useful, is it even possible?
any ideas?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
It depends on where you are displaying the data. If it is on an ASP.NET page then newline char will be <br> . Try Environment.NewLine
|
|
|
|
|
WinForms app, it will be displayed on a DataGridView and Crystal Report
Environment.NewLine has the same affect as "\r\n"...
i just noticed that its displaying correctly on the crystal report, but im seeing the square-like character in the DataGridView which is where the data is seen before the report is generated.
is there may be some property on the DataGridView to make it interpret the new line as a new line instead of the square-like character?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Looks like it don't support displaying multi line text. I am not sure about making gridview to display multi line text.
|
|
|
|
|
I have a while loop in my code...
for example, while (i<5)
{
do something
}
I want to read the value '5(the number specified in config file)' from app.config file. How do I go about it?
Basically I want to say the number of iterations from the config file.
Thanks for any suggestions.
Tina_K
modified on Tuesday, July 8, 2008 11:25 AM
|
|
|
|
|
int myCounter = Int32.Parse(ConfigurationManager.AppSettings["NumberOfLoops"]);
while (myCounter < 5)
{
doStuff();
}
remember to add using System.Configuration;
hope it helps
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
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.
|
|
|
|