ASP.net webpage and database

B

Beginner

Hello, I have an ASP.net webpage and I would like to include many articles
about trees.

I though about creating a SQL server database and bind it to my ASP.net
webpage. I know how to bind a database to ASP.net but I don't know if it is
a good idea to store the articles in my database as binary data (I think it
would be more efficient if I only store a pointer to it). What do you think?
XML maybe? I need examples because I'm a beginner.

My intention is that the ASP.net page receives a parameter (say
"ArticleID?=12345") and then loads the 12345 article from the database.

Thanks,
 
G

Guest

My intention is that the ASP.net page receives a parameter (say
"ArticleID?=12345") and then loads the 12345 article from the database.

This is a regular approach for all database-driven websites.
 
B

Beginner

Sounds OK to me...

And should I store the articles as binary data in the database or should I
store them elsewere?

If you have links with code examples, I'd be grateful.

Thanks,
 
G

Guest

And should I store the articles as binary data in the database or should I
store them elsewere?

If you have links with code examples, I'd be grateful.

Thanks,




- Show quoted text -

Create a table Articles

Id int (as an identity column)
Text nvarchar(max)

then to insert data use

string text = "...text here....";
SqlConnection DataConnection = new SqlConnection(Connection);
string Command = "INSERT INTO Articles VALUES (@Text)";
SQLCommand DataCommand = new SqlCommand(Command, DataConnection);
DataCommand.Parameters.AddWithValue("@Text", text);
DataCommand.Connection.Open();
DataCommand.ExecuteNonQuery();
DataCommand.Connection.Close();

See more on MSDN or ASP.NET: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/default.aspx

Hope this helps
 
C

Craig

Hi,

I would say that the formatting of the articles would dictate your method.
Do you need to maintain fonts and pictures? If so, storing the articles as
PDFs on the server, then referencing their ID in the database to grab the
location/file name then display accordingly. If you want to go this way, I
could cobble some psuedo code together for you. If you just need the text,
then a nvarchar() in the table will do the trick.

Craig




Beginner said:
Sounds OK to me...

And should I store the articles as binary data in the database or should I
store them elsewere?

If you have links with code examples, I'd be grateful.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top