|
Hi Dave
Thanks for your input.
Actually I am trying to make a data connection class independent of database vendors.
Now If the Provider is not System.Data.OleDb and something like "PostgreSQL OLE DB Provider", then how can I make it generic which the developer will like to use only System.Data.OleDb to connected to other databases like DB2 or Oracle (thou we have a namespace in .Net for oracle, still u can use System.Data.OleDb)
Thanks for you valuable time.
ANY ONE ELSE THERE WHO CAN HELP OUT
Regards
PS
Pradeep Sen
Project Manager
Kunming
China
|
|
|
|
|
You'd have to let the developer supply you with the DataProvider name or supply the connection object to your code.
Pradeep Sen wrote: thou we have a namespace in .Net for oracle, still u can use System.Data.OleDb
Yep, and by using OleDb, you also lose any optimizations specifice to that provider costing you speed and flexibility.
If it were me, I'd probably supply data layers for specific databases, like Oracle, SQL Server, and Access, then let the developer write their own data layer classes using the interfaces you provide to do so.
|
|
|
|
|
Hi Dave
Thanks for your suggestions.
I was looking to avoid writing different datalayers.
Is there anyway, I can use Postgre using the system.data.common?
Else, I have to take up the layered scope.
Thanks in advance
Regards
Ps
Pradeep Sen
Project Manager
Kunming
China
|
|
|
|
|
The classes found in Common are for writing your own DataProviders. You can read a bit on the subject here [^] (registration is free).
|
|
|
|
|
Does anyone know if it's possible program with .net 4.0 from Visual Studio 2008?
If so, how?
I've already installed .net 4.0 on my computer, but when I when to set the target framework under the project's properties, I can only go up to 3.5. Upgrading to Visual Studio 2010 is out of the question because this is a team porject on multiple machines, and we would have to get licences for all the machines the team is using when we already have licences for 2008.
|
|
|
|
|
You can't target .NET 4 from Visual Studio 2008. What you could do is code your application up in VS2008 and then compile it manually using the .NET 4 compiler directly.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Visual Studio 2008 can only target .NET Framework 3.5, 3.0, or 2.0. Visual Studio 2010 can target 2.0, 3.0, 3.5, 3.5 Client Profile, 4.0, or 4.0 Client Profile and includes an ability to target additional framework releases in the future.
You can install Visual Studio 2010 side-by-side with Visual Studio 2008.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Which makes me think it may be possible to hack VS 2008 to use .net 4. (Not that I want to, other than as an exercise, mind you.)
|
|
|
|
|
I think it is a hard-coded list, which would mean it's not possible. In VS2010, when you click the link for "more Frameworks" it simply takes you to the download page for the .NET Framework.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Yes, but I had some minor success in trying to trick VS 2008 into thinking that v4 is actually v3.5. It looks like it's mostly a matter of configuring MSbuild.
|
|
|
|
|
No, it's not. You can either use VS2010 or the command line compilers without Visual Studio.
|
|
|
|
|
fct2004 wrote: Does anyone know if it's possible program with .net 4.0 from Visual Studio 2008?
Nope.
You cannot run Silverlight 4 either.
|
|
|
|
|
And you only get the new version of GACUTIL by installing VS 2010.
|
|
|
|
|
Hi, I've been trying to figure out how to send commands for a printer installed in a USB port. Previously I could do this with the LPT1 port by calling kernel32.dll CreateFile method (DLLImport) and sending the commands this way. But with USB ports this doesn't work.
So does anybody know how to do that? Or at least have any article on that matter, I couldn't find anything (sorry if its easy to find, I just suck at finding stuff).
So my requirement is, cycle through USB ports to check if there is any device attached. If there is a device attached, send a command to ask the device to identify itself.
So basically I'll need two things, learn to dynamically cycle through USB port, send commands to it and read the responses.
All of that using C# and .Net Framework 2.0.
Any ideas?
Thanks in advance for any help. Regards,
Fábio
modified on Saturday, April 24, 2010 9:44 AM
|
|
|
|
|
|
That's great!!! For now you solved my needs. But soon I will also need to read from it. Hopefully I'll figure out on my own, studying the code and the spooler usage. Anyway, thanks a lot.
And thank for clearing it about the fact that USB port is not really a port. 5!
|
|
|
|
|
Reading from a printer? That's not going to happen by studying that code I kinked to.
Then again, you haven't said WHAT you think your going to read or why you need it.
|
|
|
|
|
Sorry for that. Let me clear it out. I need to talk to the printer because it's a Zebra printer with RFID capability. What I will do is send ZPL commands to the port and read the response. Zebra receives ASCII commands and responds with ASCII too.
There are several uses for the printer's responses, including telling the success of a RFID TAG write operation.
Perhaps I will need another alternative to the spooler API to acomplish that.
Thanks again for your help.
|
|
|
|
|
Yep. The spooler will not return anything to you. This kind of printer should have an SDK available from the manufacturer, making all of the code you just got moot.
|
|
|
|
|
Yeah, I wish it did. I contacted Zebra and they don't have anything for .Net yet. They should have in the near future, but couldn't give any dates. And I need it now. That's why I was asking for a way to talk to the BUS, no matter the device. And if I get that, I'll also be able to use to talk to the fingerprint reader from Microsoft on another project of mine, which seems there is no SDK either, just the drivers.
Thanks for your help
|
|
|
|
|
Fabio Franco wrote: That's why I was asking for a way to talk to the BUS, no matter the device.
There's no such thing on USB. You have no choice but to talk to the DEVICE on the bus. You cannot treat the USB port like it was a serial or parallel port. That's like trying to communicate to a card inserted into an expansion slot on the motherboard by talking to the slot it's plugged into. You can't do it.
If they don't have a .NET specific library, you've going to have to make do with either normal C-style library and P/Invoke the functions or, hopefully, they have a COM-based library that you can use. Just because they don't support .NET directly does not mean that your out of luck. It's just going to take more work.
|
|
|
|
|
I think I may have put the wrong words. What I really meant is talk to the device "through" the bus. There must be a way to choose a specific BUS to talk to a device. I mean, even if I develop something specific to the device, I need to know where it is connected to.
I think about it in two ways:
1 - Make use of the device driver so it carries the messages for me.
2 - Find the device (in which "slot" its plugged in) and send the message myself.
I will do the talking to the device myself, thats for sure. I just need to know how to FIND it!
I know I don't talk to the USB, but I know I must use it to talk to the device, messages can't magically find it's way to the device. The USB must have an address I can find and talk through. That's where I'm stuck. How could I cycle through the USB slots on a computer, and send/receive messages through it?
There must be a standard way to make use of the USB slots, how the device will understand my commands is not the problem, this I know how to do it already (as I said, done this in LPT1). Windows must have some Win32 APIs available to acomplish what I want. Or maybe the drivers of the USB to do it. This is where I'm lost. In your experience what do you think? Am I looking at it the wrong way?
Thanks again
|
|
|
|
|
Fabio Franco wrote: I think I may have put the wrong words. What I really meant is talk to the device "through" the bus. There must be a way to choose a specific BUS to talk to a device. I mean, even if I develop something specific to the device, I need to know where it is connected to.
I think about it in two ways:
1 - Make use of the device driver so it carries the messages for me.
2 - Find the device (in which "slot" its plugged in) and send the message myself.
I will do the talking to the device myself, thats for sure. I just need to know how to FIND it!
That's what the SDK is for. Or, you can start with this article[^].
Fabio Franco wrote: I know I don't talk to the USB, but I know I must use it to talk to the device, messages can't magically find it's way to the device. The USB must have an address I can find and talk through. That's where I'm stuck. How could I cycle through the USB slots on a computer, and send/receive messages through it?
Fabio Franco wrote: how the device will understand my commands is not the problem, this I know how to do it already (as I said, done this in LPT1
Yeah, but do you know what you're "saying"?? What messages? How are they built? What is the structure for each command?? Without the SDK, you're talking complete gibberish. You're not sending the same messages you send over LPT1. These are Device commands, not escape codes your sending.
|
|
|
|
|
Dave Kreskowiak wrote: Yeah, but do you know what you're "saying"?? What messages? How are they built? What is the structure for each command?? Without the SDK, you're talking complete gibberish. You're not sending the same messages you send over LPT1. These are Device commands, not escape codes your sending.
I think you're not understanding what I'm saying. I'm completely aware of what to send the device. The printer understands ZPL Language[^]. In fact it understands it as plain text (8 byte character ASCII text) and it understands commands like *IDN? -> The standard for a device to identify itself, either sending it as plain text or bytecode.
So no, I'm not talking gibberish, I'm talking the device's language. For the case of the fingerprint reader, I'll have to understand it's language and the way to communicate (text, byte, etc). But it will work the same way.
I've programmed to several devices including, OTDRs through GPIB interface, printers through LPT1 port and other personal projects (my own designed circuit boards) through serial port. The only thing I couldn't do so far is talk to a device through USB.
I don't need an SDK. It would make my life easier, but I don't need it.
Thanks
|
|
|
|
|
Fabio Franco wrote: I think you're not understanding what I'm saying. I'm completely aware of what to send the device. The printer understands ZPL Language[^]. In fact it understands it as plain text (8 byte character ASCII text) and it understands commands like *IDN? -> The standard for a device to identify itself, either sending it as plain text or bytecode.
Trust me, it's the other way around. The language your send to the printer is ZPL. The message format you need to send using DeviceIo is not. It's a carrier of ZPL or whatever other data your sending to the printer.
How about this. You're calling a friend oversees and want to have a conversion in Enlgish. You both know English, but do you know how to the sounds of English are transmitted over the wire? What "language" is being used for that? It isn't English...
|
|
|
|
|