hi i have small project which is something like news portal where one is allowed to post news.now database structure is something like this . news table has following columns
news : newsid int , news varcahr
and resource table
resource : resid int
nwsfref int -->it refereces to newsid
path varchar-->contains path of folder where images/videos are uploaded
for resource uploaded i am using fileupload control .
as we know one must explicitly provide a control or mechanism to allow the user to submit the specified file. i am using button that the user clicks to upload the image as well as news
but problem with this approach that for a single news only one img/videos can be uploaded . what do if i want to to upload multiple images for single news item. i mean to say that i wanted to uplaod multiple image plus news should be uploaded on single click of an button
please help .
thank u
anoop
update
here is mu stored procedure for inserting news and images in database but its giving me foregin key constriants
please correct the logic
stored procedure to insert news
create procedure spnews @title varchar(50),@news varchar(max)
as begin
declare @idint int
select @idint = max(newsid) from newso
if @idint is null
set @idint = 1
else
set @idint = @idint + 1
insert into newso values(@idint,@title,@news)
end
and here is stored procedure for inserting into resource table but its giving me error of foregin key constaint
create procedure spres @title varchar(50),@path varchar(max)
as begin
declare @intid int,@refid int,@fullpath varchar(max)
select @intid = max(resid) from resource
if @intid is null
set @intid = 1
else
set @intid = @intid + 1
select @refid = max(newsid) from newso
if @refid is null
set @refid = 1
else
set @refid = @refid + 1
if @path is not null
set @fullpath = '~/uplaod/'+@path
else
set @fullpath = null
insert into resource values(@intid,@refid,@title,@fullpath)
end
[Edited]Code is wrapped in "pre" tag[/Edited]