newid = Request.QueryString("newid")
Dim SelectCommand As String = "SELECT * FROM news WHERE newid = '" & newid & "' "
Dim da As New SqlDataAdapter(SelectCommand, conn)
da.Fill(ds, "news")
dt = ds.Tables("news").Rows(0)
Dim xfile As String = "upload/" & dt("fileupload")
Dim image As String = Server.MapPath(xfile)
If File.Exists(image) Then
File.Delete(image)
End If
Dim DeleteCommand As String = "DELETE FROM news WHERE newid = '" & newid & "' "
Dim com As New SqlCommand(DeleteCommand, conn)
With com
.Connection = conn
.CommandType = CommandType.Text
.CommandText = DeleteCommand
.ExecuteNonQuery()
End With[img][/img]
Response.Redirect("viewAddnews.aspx")
dim selectcommand as string = "select * from news where newid = '" & newid & "'"
dim da as new sqldataadapter(selectcommand,conn)
dim ds as new dataset
if not (ds.tables("new") is nothing) then
ds.tables("new").clear()
end if
da.fill(ds,("new")
dim dt as new datatable
dt = ds.tables("new")
if dt.rows.count <> 0 then
dim strNewID as string = dt.dataset.tables("new").rows(0)("newid").tostring()
esle
msgbox.show("No Data !!")
end if