473,786 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert BLOB using System.Data.ODB C

Hi all,

I am trying to use System.Data.ODB C to insert a file into a binary field in
SQL Server 2000. Now, before you yell at me, the reason I am doing this is
that I am only writing intitial code against SQL, but this app will need to
be able to run against any ODBC compliant DB, so I am also not using stored
procedures.

I have tangles with this for hours, but I cannot seem to figure out how to
just read the contents of a file off disk and write it into a binary field in
SQL not using a stored procedure. If I can get that working, I can do
whatever I need, but I can't so far.

Does anyone have a sample of this or an article? There are many articles for
doing this with SPROCS, doing this with SqlClient, not ODBC. I tried just
modifying the objects from an SqlClient example, but no avail.

Appreciate any help on this...
Nov 26 '05 #1
3 2924
On Sat, 26 Nov 2005 08:58:02 -0800, "Chris" <Ch***@discussi ons.microsoft.c om> wrote:

¤ Hi all,
¤
¤ I am trying to use System.Data.ODB C to insert a file into a binary field in
¤ SQL Server 2000. Now, before you yell at me, the reason I am doing this is
¤ that I am only writing intitial code against SQL, but this app will need to
¤ be able to run against any ODBC compliant DB, so I am also not using stored
¤ procedures.
¤

Unfortunately this simply isn't going to be possible. The reason is that most databases use a
proprietary implementation that in all likelihood would not be uniformly supported via ODBC (which
is rather dated technology to begin with).
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 29 '05 #2
Paul,

Thanks for the response, but it's very interesting, you are not the first
person to respond to my question with that answer, but I got it working a few
days ago, inserting a blob into the database using the odbc provider and no
stored procedures, and it's worked on SQL, PostGreSQL, and MySQL so far with
the same code, so I think it is possible.

Thanks anyway...

"Paul Clement" wrote:
On Sat, 26 Nov 2005 08:58:02 -0800, "Chris" <Ch***@discussi ons.microsoft.c om> wrote:

¤ Hi all,
¤
¤ I am trying to use System.Data.ODB C to insert a file into a binary field in
¤ SQL Server 2000. Now, before you yell at me, the reason I am doing this is
¤ that I am only writing intitial code against SQL, but this app will need to
¤ be able to run against any ODBC compliant DB, so I am also not using stored
¤ procedures.
¤

Unfortunately this simply isn't going to be possible. The reason is that most databases use a
proprietary implementation that in all likelihood would not be uniformly supported via ODBC (which
is rather dated technology to begin with).
Paul
~~~~
Microsoft MVP (Visual Basic)

Nov 29 '05 #3
On Tue, 29 Nov 2005 11:42:07 -0800, "Chris" <Ch***@discussi ons.microsoft.c om> wrote:

¤ Paul,
¤
¤ Thanks for the response, but it's very interesting, you are not the first
¤ person to respond to my question with that answer, but I got it working a few
¤ days ago, inserting a blob into the database using the odbc provider and no
¤ stored procedures, and it's worked on SQL, PostGreSQL, and MySQL so far with
¤ the same code, so I think it is possible.
¤
¤ Thanks anyway...

Well you said *any* so I was assuming that was more than a few. ;-)

There will be some databases that support the same code but others will not, or they will require a
different data type than binary. I believe that both Oracle, Sybase or Microsoft Access would all
require different solutions.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 30 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6444
by: Johan Vervoort | last post by:
How can I read a binary value from a blob via ODBC (Microsoft VFP driver-win32all)? The value seems to be truncated at the first '\0' TIA
2
17800
by: Ole Hansen | last post by:
Hi, Is it possible to insert BLOB data without doing a select first? I have data available and want to insert a row with BLOB data. Should I use the callback function with OCILobWrite() or is it not possible at all without doing a select? How about using a temporary LOB? I have tried everything I could come up with but nothing seems to work.
2
6879
by: Niraj | last post by:
Hi, I am trying to do bulk insert of binary data (array of bytes) in an Oracle table. The data type of the table is BLOB. I am using Oracle Objects for OLE (OO4O) in C++. The binary data that I have to insert is in the form of byte array. My problem is that the bulk inserts happen only as long as the length of array is less than 4K. Any data more than 4K gets truncated. Is it possible to do bulk inserts in a BLOB field with data more...
0
2274
by: John D. | last post by:
I am having problems inserting Decimal values into a DB2 database via a .NET/C# application which is using an OdbcDataAdapter. Other field types such as VarChar, Int, Date, etc work ok, and I can insert literal values into a decimal field, but any attempt to insert a decimal field via an OdbcParameter causes a System.InvalidOperationException ("The connection is dead") to be thrown by the DbDataAdapter.Update method. The ODBC driver is...
11
23034
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
0
1857
by: Sharon | last post by:
I have a problem using with dbf file here. I have tried the code below using VB.NET with no errors. However, I use the exact same code in ASP NET, it prompt me error when I tried to insert a record. The error Detail : ERROR Operation must use an updateable query. Description: An unhandled exception occurred during the execution of the
0
1156
by: LuisH | last post by:
Hi, I'm very new on this group. I don't know if this is a old point here. My question is: What is the best way to access Blob rows using C/C++ on PostgreSQL ????? 1) Using ODBC and using SELECT I can use SQLGetData to receive many parts of each Blob.
2
4567
by: Chenna Sudarsan | last post by:
Hello, I am connecting to Oracle9.2 database from VB6.0 using MSDAORA provider. I am using ADO2.5. When I try to access a blob column of oracle I am getting the below mentioned error. -------------------- Run-time error '-2147467259 (80004005)': Data type is not supported.
1
16310
by: shallowpool | last post by:
Can someone provide me the simple syntax necessary to insert or update to a row containing a single BLOB column, where the BLOB data will be obtained from a file? This is on a linux installation. The table has 2 INTs and 1 BLOB column. So, I've scoured various docs and such, and the closest I've come up with is some sort of animal that looks like this: db2 load from /tmp/myblobfile of asc method L (1 780) insert into......
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.