It did not work dear. As the User will be updating new documents every day. Also since the documents are being uploaded from client side the file path and name cannot be sent to the table field. I tried to get the file from table and save it on server and give the hyperlink that address but it again didnot work. I am using following procedure :
Con = New SqlConnection(MainConStr)
SQLStr = "Select ruid, report, 'File Name' as reportnm from case_initial where court_cd = 'C001'"
Dim b, i As Integer
Dim sqladp As New SqlDataAdapter(SQLStr, Con)
Dim ds As New DataSet
b = sqladp.Fill(ds, "Try")
Dim MyData() As Byte
Dim fs As FileStream
For i = 0 To ds.Tables("Try").Rows.Count - 1
If Not IsDBNull(ds.Tables("Try").Rows(i).Item(1)) Then
MyData = ds.Tables("Try").Rows(i).Item(1)
Dim k As Long
k = UBound(MyData)
fs = New FileStream(Server.MapPath(".\Created" & i & ".doc"), FileMode.OpenOrCreate, _
FileAccess.Write)
fs.Write(MyData, 0, k)
ds.Tables("Try").Rows(i).Item(2) = Server.MapPath(".\Created" & i & ".doc").ToString
fs.Close()
fs = Nothing
End If
Next
Con.Close()
Con = Nothing
Me.GridView1.DataSource = ds
Me.GridView1.DataBind()
where my gridview declaration is :
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="370px">
<Columns>
<asp:BoundField DataField="ruid" HeaderText="Appno" ReadOnly="True" SortExpression="ruid" />
<asp:HyperLinkField DataNavigateUrlFields="reportnm" DataTextField="reportnm" HeaderText="File" />
</Columns>
</asp:GridView>
|