save attachments in MS Access via a web form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a C# web application in ASP.Net, which has a user contact info DB in
MS Access. Can I add a column to each user to save pdf attachments for each
user if needed? If so, how do we do this?

Thanks for help.

-Dale
 
Dale,

I don't think that you want to dynamically add a new column for every
user. Rather, you should have a table which has a user name, and a blob
field (binary, varbinary) which you can then store the bytes of the file in.
This is accompished easily through the appropriate data adapter, which will
more than likely represent the column as a byte array in the data set.

Hope this helps.
 
Nicholas,

Sure, I would have a static column dedicated for this. In MS Access, a blob
field means an OLE object? Is there any example and info about this?

Thanks. -Dale

Nicholas Paldino said:
Dale,

I don't think that you want to dynamically add a new column for every
user. Rather, you should have a table which has a user name, and a blob
field (binary, varbinary) which you can then store the bytes of the file in.
This is accompished easily through the appropriate data adapter, which will
more than likely represent the column as a byte array in the data set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

dale zhang said:
Hi,

I have a C# web application in ASP.Net, which has a user contact info DB
in
MS Access. Can I add a column to each user to save pdf attachments for
each
user if needed? If so, how do we do this?

Thanks for help.

-Dale
 
Dale,

Yes, an OLE object field is what you want.

Check out the article titled "Reading and Writing Bitmaps or BLOB Data
in ADO.NET" at (watch for line wrap):

http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp

It's in VB, but you can easily change that to C#.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

dale zhang said:
Nicholas,

Sure, I would have a static column dedicated for this. In MS Access, a
blob
field means an OLE object? Is there any example and info about this?

Thanks. -Dale

Nicholas Paldino said:
Dale,

I don't think that you want to dynamically add a new column for every
user. Rather, you should have a table which has a user name, and a blob
field (binary, varbinary) which you can then store the bytes of the file
in.
This is accompished easily through the appropriate data adapter, which
will
more than likely represent the column as a byte array in the data set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

dale zhang said:
Hi,

I have a C# web application in ASP.Net, which has a user contact info
DB
in
MS Access. Can I add a column to each user to save pdf attachments for
each
user if needed? If so, how do we do this?

Thanks for help.

-Dale
 
Nicholas,

The article is very good. When i tried to translate it to C# as below:

Image curImage = null;
string curFileName = null;
string savedImageName = "C:\\imageFromDb.BMP";

The compiler can not understand "Image" as below:
c:\inetpub\wwwroot\passwordProtectCSharp\adminUserFile.aspx.cs(33): 'Image'
is an ambiguous reference

Any idea? Thanks. -Dale
Nicholas Paldino said:
Dale,

Yes, an OLE object field is what you want.

Check out the article titled "Reading and Writing Bitmaps or BLOB Data
in ADO.NET" at (watch for line wrap):

http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp

It's in VB, but you can easily change that to C#.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

dale zhang said:
Nicholas,

Sure, I would have a static column dedicated for this. In MS Access, a
blob
field means an OLE object? Is there any example and info about this?

Thanks. -Dale

Nicholas Paldino said:
Dale,

I don't think that you want to dynamically add a new column for every
user. Rather, you should have a table which has a user name, and a blob
field (binary, varbinary) which you can then store the bytes of the file
in.
This is accompished easily through the appropriate data adapter, which
will
more than likely represent the column as a byte array in the data set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

I have a C# web application in ASP.Net, which has a user contact info
DB
in
MS Access. Can I add a column to each user to save pdf attachments for
each
user if needed? If so, how do we do this?

Thanks for help.

-Dale
 
Back
Top