I want to store my e-books on my intranet that I am developing, the idea is to store the link to the e-book in the DB and store the files in a folder. I have searched the web for similar tutorials but no luck or maybe just not been looking at the right spots. The idea is to manage my e-book let say display them by category , to be able to add ,delete or edit them. Anyway my DB has the following structure:
ID int
Title nvchar
filepath varchar(200)
dateposted date/time
categoryID int
can any one give me a way to go forward. even if it's a side that i need to visit.
Vijaya KadiyalaPosted Jun 25, 2008, 2:26 PM
Hi,
i agree with Bechir solution, this is perfect solution for your requirement. How about the code to upload file to the Server!? do you have that?
Thanks -- Vj
http://dotnetvj.blogspot.com
Bechir BejaouiPosted Jun 23, 2008, 10:15 AM
Use the Sql Server
Create a data base Library
Create TableName
(
D int,
Title nvchar,
filepath varchar(200),
dateposted datetime,
categoryID int,
)
Then create a Stored Procedure like thatCREATE PROCEDURE ADDUSER
(
@ID int, @Title nvarchar, @Path varchar(200), @Date DateTime, @CatID
)
AS INSERT INTO TABLENAME(
D,Title,filepath,dateposted, categoryID) VALUES(@ID int, @Title nvarchar, @Path varchar(200), @Date DateTime, @CatID)
go now to the application and add five fileds:
and add this code and excute it:
sqlConnection cn = new SqlConnection("Data Source= your server name, Initial catalog=your data base name, Integrated security=true");
sqlCommand cm = new sqlCommand("ADDUSER");
cm.CommandType = CommandType.StoredProcedure;
SqlParameter param1 = new SqlPameter("@ID",SqlDBType.Int);
SqlParameter param2 = new SqlPameter("@Title",SqlDBType.String);
SqlParameter param3 = new SqlPameter("@Path",SqlDBType.String);
SqlParameter param4 = new SqlPameter("@Date",SqlDBType.DateTime);
SqlParameter param5 = new SqlPameter("@CatID",SqlDBType.Int);
Text1.Text = param1.Value;
Text2.Text = param2.Value;
Text3.Text = param3.Value;
Text4.Text = param4.Value;
Text5.Text = param5.Value;
cmd.executenonquery();