-
-
-
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
-
-
If FileUpload1.HasFile Then
-
Try
-
' alter path for your project
-
FileUpload1.SaveAs(Server.MapPath("~/ExcelImport.xls"))
-
Label1.Text = "Upload File Name: " & _
-
FileUpload1.PostedFile.FileName & "<br>" & _
-
"Type: " & _
-
FileUpload1.PostedFile.ContentType & _
-
" File Size: " & _
-
FileUpload1.PostedFile.ContentLength & " kb<br>"
-
Catch ex As Exception
-
Label1.Text = "Error: " & ex.Message.ToString
-
End Try
-
Else
-
Label1.Text = "Please select a file to upload."
-
End If
-
-
End Sub
-
-
Protected Sub btnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsert.Click
-
Try
-
Dim DataAdapter As New OleDbDataAdapter()
-
-
' retrieve the Select command for the Spreadsheet
-
DataAdapter.SelectCommand = ExcelConnection()
-
-
' Create a DataSet
-
Dim ds As New DataSet()
-
' Populate the DataSet with the spreadsheet worksheet data
-
DataAdapter.Fill(ds, "T_HQ_BADGE")
-
-
ds.Tables(0).TableName = "T_HQ_BADGE"
-
ds.Merge(ds.Tables("T_HQ_BADGE"))
-
-
Catch ex As Exception
-
Label1.Text = "Error: " & ex.Message.ToString
-
End Try
-
-
'For i = 0 To ds.Tables("HQ_BADGE").Rows.Count - 1 Step i + 1
-
-
' Dim Query As String = "Insert into T_HQ_BADGE (HQBD_PLAZANO,HQBD_BADGENO,HQBD_GROUPLEVEL,HQBD_BADGENAME,HQBD_PASSWORD,HQBD_MFGNO) values('" + ds.Tables("HQ_BADGE").(i)("HQBD_PLAZANO").tostring() + "','" + objDataSet.Tables("HQ_BADGE").(i)("HQBD_BADGENO").tostring() + "','" + objDataSet.Tables("HQ_BADGE").(i)("HQBD_PLAZANO").tostring() + "','" + objDataSet.Tables("HQ_BADGE").i("HQBD_PLAZANO").tostring() + "','" + objDataSet.Tables("T_HQ_BADGE").(i)("HQBD_GROUPLEVEL").tostring() + "','" + objDataSet.Tables("HQ_BADGE").(i)("HQBD_BADGENAME").tostring() + "','" + objDataSet.Tables("HQ_BADGE").(i)("HQBD_PASSWORD").tostring() + "','" + objDataSet.Tables("HQ_BADGE").(i)("HQBD_MFGNO").tostring() + ")"
-
-
'Next
-
'DataAdapter.Fill(ds, "Badge")
-
'for each ( datarow rowExcel in ds.Tables("T_HQ_BADGE"))
-
' rowExcel.SetAdded() ' sets its RowState to "Added"
-
' DataSet.Tables("import1").ImportRow(rowExcel)
-
'Next
-
-
End Sub
-
Protected Function ExcelConnection() As OleDbCommand
-
-
Dim xConnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= C:\Import from Excel\Badge.xls ;Extended Properties=""Excel 12.0;HDR=Yes;IMEX=2""" 'Connection String to Excel Workbook
-
-
' create your excel connection object using the connection string
-
Dim objXConn As New OleDbConnection(xConnStr)
-
'objXConn.Open()
-
-
Dim Command As New OleDbCommand("SELECT [HQBD_PLAZANO],[HQBD_BADGENO],[HQBD_GROUPLEVEL],[HQBD_BADGENAME],[HQBD_PASSWORD],[HQBD_MFGNO] FROM [Badge$]", objXConn)
-
-
Return Command
-
-
End Function
-
-
End Class
-
-
Hai,
here i wrote my code.can any one plz suggest me how to bind the dataset data to oracle database temporary table.
main thing is no need to show in gridview.that data just insert in the temporary table.
plz any one suggest me.
Thaks in advance.
0 1155 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Corrine |
last post by:
Hi,
I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB...
|
by: Hans Bampel |
last post by:
hello group,
i want to denormalize data in a temporary table for a second
business-system which cant read related datas
what i have:
table Partner: (Id_Partner, NamePartner, ...)
table...
|
by: prasad |
last post by:
I am getting sql error during binding a program which access a temporary table.
The temporary table declaration and access methods are given below.
EXEC SQL
DECLARE GLOBAL TEMPORARY TABLE TEM88...
|
by: vsaraog |
last post by:
Hi everybody,
I asked the following question but didn't get any reply. If anyone
knows something about the problem, then please reply since I am really
in a bind. Here is the question...
I...
|
by: Larry |
last post by:
Hi,
I have unbelievable problems just to save a record!
I make an input to a record in a subform, which has a
temporary table as its recordsource.
When I am done, and want to save the...
|
by: Gareth Stretch |
last post by:
Hi Guys. i am using C#.net connecting to an Access database using
OleDbConnection i am using the following select Statement to join 3
tables
string strdvds = "SELECT dvd.name,...
|
by: R |
last post by:
Hi
If I have typed dataset with sql client and I am moving the db to oracle,
can I use the typed dataset I have created for the sql?
|
by: R |
last post by:
If yes, can I use visual studio to create the dataset just like when
connecting to sql and creating dataset?
|
by: Rahul B |
last post by:
Hi,
I have very little knowledge about creating Procedures/functions in
DB2.
When i tried to create the test function like
CREATE FUNCTION GET_TEST
(P_TEST_ID INTEGER,
P_SEL_OR_SORT...
|
by: RobertC |
last post by:
Using a Access project, I create a temporary table in the SQL tempdb database and use it to edit records uploaded from the permanent table. When the user is finished editing, the record is written...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |