By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,460 Members | 1,167 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,460 IT Pros & Developers. It's quick & easy.

excel file export to SQL server

P: n/a
hi guyz .. can anyone have an idea to export a excel file into sql server
table using web interface .

please give me an idea on this

thank u very much
san
auck


Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Sanju,

Have a look to this example, instead of the image you can also use an excel
file or whatever.

The only point is that it is visa versa on your question, this saves and
brings a file from a webserver to a dataset on the client.

I think that when you see it it is easy to translate to your problem.

Cor
\\\
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(fo.FileName, _
IO.FileMode.Open)
Dim br As New IO.BinaryReader(fs)
abyt = br.ReadBytes(CInt(fs.Length))
br.Close()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(sf.FileName, _
IO.FileMode.CreateNew)
Dim bw As New IO.BinaryWriter(fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataBaseUpdate
ws.SetDataset(abyt)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataBaseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream(abyt)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\wsblob.xml")
Return CType(ds.Tables(0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVal abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(New DataTable("Photo"))
ds.Tables(0).Columns.Add(New DataColumn("Sample"))
ds.Tables(0).Columns(0).DataType = GetType(System.Byte())
ds.Tables(0).Rows.Add(ds.Tables(0).NewRow)
ds.Tables(0).Rows(0)(0) = abyte
ds.WriteXml("C:\wsblob.xml", XmlWriteMode.WriteSchema)
End Sub
////

Cor
Nov 20 '05 #2

P: n/a
Hi San

You could create a datatable and browse all the cells of
the excel document and add the value in the datatable.

Finally you could add the datable to a dataset and use a
ASP.NET for the web interface.

Kind Regards
Jorge
-----Original Message-----
hi guyz .. can anyone have an idea to export a excel file into sql servertable using web interface .

please give me an idea on this

thank u very much
san
auck


.

Nov 20 '05 #3

P: n/a
Hi San

You could create a datatable and browse all the cells of
the excel document and add the value in the datatable.

Finally you could add the datable to a dataset and use a
ASP.NET for the web interface.

Kind Regards
Jorge
-----Original Message-----
hi guyz .. can anyone have an idea to export a excel file into sql servertable using web interface .

please give me an idea on this

thank u very much
san
auck


.

Nov 20 '05 #4

P: n/a
On Mon, 17 May 2004 18:54:13 +1200, "sanju" <sa**********@xtra.co.nz> wrote:

hi guyz .. can anyone have an idea to export a excel file into sql server
table using web interface .

please give me an idea on this


See the following MS KB article:

HOW TO: Import Data into SQL Server from Excel
http://support.microsoft.com/default...b;en-us;321686
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #5

P: n/a


thank u cor.. i will try to work on this ..

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.