-5

I'm working with ASP.NET in Microsoft Visual Studio 2010. When I did my database I had Microsoft Access. Now I don't have it (have tried to get it), so I thought that the best idea is to change my table with code. I want to add a column to my table that can fit pictures. How do I do it? I thought that I do an .aspx file(Webpage), then in the .aspx.cs file I write my code. I run it once changing my table and have what I want and delete that file. Is there another way without other programs?

My table is called item and I want to add the column that can have a picture. What's the code for that? Thanks!

Pichi Wuana
  • 732
  • 2
  • 9
  • 35
  • You can't easily manage a database writing code every time you want to do something. Install the proper client. – Rick S Jun 24 '15 at 18:53
  • What do you mean with client? Software program? – Pichi Wuana Jun 24 '15 at 18:53
  • If it's an Access database install Access. If it's SQL server install SQL server mgmt studio. If you really want to add a column, send an `ALTER TABLE` command to the database. – Rick S Jun 24 '15 at 18:55
  • Why don't you use the client tool SQL Server Management Studio? Unless you want to re-invent every variation in datamodelling that's already usable in SSMS. If so, the easiest way is to learn SQL and kick of the necessary queries to update/change your database from code (even that would be easier todo in SSMS). – Dacker Jun 24 '15 at 18:56
  • @RickS I can't find where to install Access(I don't have money for buying it...) – Pichi Wuana Jun 24 '15 at 19:04

2 Answers2

1

You can use the ALTER TABLE Command:

ALTER TABLE item ADD COLUMN picture varbinary
laskdjf
  • 1,166
  • 1
  • 11
  • 28
0

Well, you can add the column using SQL, which I am assuming you are familiar with.
ALTER TABLE table_name ADD column_name column-definition;
So that is something you would want to run 1 time and make sure you define the column correctly;

Alternatively, you can edit the Table Definition from the server explorer by right clicking on the table and clicking table definition. Then you can add or change what ever you like.

fieora
  • 36
  • 2