Home All Groups Group Topic Archive Search About

ASP.net webpage and database

Author
9 Jul 2009 1:58 AM
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,

Author
9 Jul 2009 9:37 AM
Alexey Smirnov
On Jul 9, 3:58 am, "Beginner" <n...@spam.com> wrote:
> 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.
Are all your drivers up to date? click for free checkup

Author
9 Jul 2009 9:46 AM
Mark Rae [MVP]
"Beginner" <no@spam.com> wrote in message
news:uOecEjDAKHA.1380@TK2MSFTNGP02.phx.gbl...

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

Sounds OK to me...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Author
9 Jul 2009 11:57 AM
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,

Show quoteHide quote
"Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message
news:uLA5foHAKHA.4004@TK2MSFTNGP05.phx.gbl...
> "Beginner" <no@spam.com> wrote in message
> news:uOecEjDAKHA.1380@TK2MSFTNGP02.phx.gbl...
>
>> My intention is that the ASP.net page receives a parameter (say
>> "ArticleID?=12345") and then loads the 12345 article from the database.
>

>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
Author
9 Jul 2009 5:57 PM
Alexey Smirnov
Show quote Hide quote
On Jul 9, 1:57 pm, "Beginner" <n...@spam.com> wrote:
> > 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,
>
> "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote in messagenews:uLA5foHAKHA.4***@TK2MSFTNGP05.phx.gbl...
>
>
>
> > "Beginner" <n...@spam.com> wrote in message
> >news:uOecEjDAKHA.1380@TK2MSFTNGP02.phx.gbl...
>
> >> My intention is that the ASP.net page receives a parameter (say
> >> "ArticleID?=12345") and then loads the 12345 article from the database.
>
> > --
> > Mark Rae
> > ASP.NET MVP
> >http://www.markrae.net- Hide quoted text -
>
> - 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
Author
9 Jul 2009 9:13 PM
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




Show quoteHide quote
"Beginner" <no@spam.com> wrote in message
news:eIXipxIAKHA.1340@TK2MSFTNGP05.phx.gbl...
>> 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,
>
> "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message
> news:uLA5foHAKHA.4004@TK2MSFTNGP05.phx.gbl...
>> "Beginner" <no@spam.com> wrote in message
>> news:uOecEjDAKHA.1380@TK2MSFTNGP02.phx.gbl...
>>
>>> My intention is that the ASP.net page receives a parameter (say
>>> "ArticleID?=12345") and then loads the 12345 article from the database.
>>
>
>>
>>
>> --
>> Mark Rae
>> ASP.NET MVP
>> http://www.markrae.net
>

Bookmark and Share