473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to bind dataset data to oracle (db) temporary table

8
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  4.  
  5.         If FileUpload1.HasFile Then
  6.             Try
  7.                 ' alter path for your project
  8.                 FileUpload1.SaveAs(Server.MapPath("~/ExcelImport.xls"))
  9.                 Label1.Text = "Upload File Name: " & _
  10.                      FileUpload1.PostedFile.FileName & "<br>" & _
  11.                      "Type: " & _
  12.                      FileUpload1.PostedFile.ContentType & _
  13.                      " File Size: " & _
  14.                      FileUpload1.PostedFile.ContentLength & " kb<br>"
  15.             Catch ex As Exception
  16.                 Label1.Text = "Error: " & ex.Message.ToString
  17.             End Try
  18.         Else
  19.             Label1.Text = "Please select a file to upload."
  20.         End If
  21.  
  22.     End Sub
  23.  
  24.     Protected Sub btnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInsert.Click
  25.         Try
  26.             Dim DataAdapter As New OleDbDataAdapter()
  27.  
  28.             ' retrieve the Select command for the Spreadsheet
  29.             DataAdapter.SelectCommand = ExcelConnection()
  30.  
  31.             ' Create a DataSet
  32.             Dim ds As New DataSet()
  33.             ' Populate the DataSet with the spreadsheet worksheet data
  34.             DataAdapter.Fill(ds, "T_HQ_BADGE")
  35.  
  36.             ds.Tables(0).TableName = "T_HQ_BADGE"
  37.             ds.Merge(ds.Tables("T_HQ_BADGE"))
  38.  
  39.         Catch ex As Exception
  40.             Label1.Text = "Error: " & ex.Message.ToString
  41.         End Try
  42.  
  43.         'For i = 0 To ds.Tables("HQ_BADGE").Rows.Count - 1 Step i + 1
  44.  
  45.         '    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() + ")"
  46.  
  47.         'Next
  48.         'DataAdapter.Fill(ds, "Badge")
  49.         'for each ( datarow rowExcel in ds.Tables("T_HQ_BADGE"))
  50.         '    rowExcel.SetAdded() ' sets its RowState to "Added" 
  51.         '    DataSet.Tables("import1").ImportRow(rowExcel)
  52.         'Next
  53.  
  54.     End Sub
  55.     Protected Function ExcelConnection() As OleDbCommand
  56.  
  57.         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
  58.  
  59.         ' create your excel connection object using the connection string
  60.         Dim objXConn As New OleDbConnection(xConnStr)
  61.         'objXConn.Open()
  62.  
  63.         Dim Command As New OleDbCommand("SELECT [HQBD_PLAZANO],[HQBD_BADGENO],[HQBD_GROUPLEVEL],[HQBD_BADGENAME],[HQBD_PASSWORD],[HQBD_MFGNO] FROM [Badge$]", objXConn)
  64.  
  65.         Return Command
  66.  
  67.     End Function
  68.  
  69. End Class
  70.  
  71.  



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.
Dec 22 '10 #1
0 1155

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
1
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...
4
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...
3
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...
7
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...
0
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,...
3
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?
2
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?
5
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...
3
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.