Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How Do I Read The Value Of Each Row Of A Specific Column In A Database?


How do I read the value of each row of a specific column in a database?

For instance, I have several rows in a table. One of the columns is called 'name'.

How do I read all the values of 'name' and put them into a combo box?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Read A Specific Http Link On A Specific Page And..
Hello ppl!
I am a REAL newbie to VB and I am trying to do a simple thing (I hope) I have no real basecode just the one to open a specific link: Code:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Form_Load()

    ShellExecute 0, vbNullString, "http://play.mp3.com/cgi-bin/play/play.cgi/AAIBQgAAAADABG5vcm1QBAAAAFLeTgEAUQoAAABYAQAAAFneTgEAQ2.J0TwUhHw6YJu97A3gU7XcOVum/fuzytoes.m3u/", vbNullString, vbNullString, vbNormalFocus
Unload Me

End Sub
Now, Id like to add some functionality since MP3.com changes the links every now and then. I need the program to go to the page, snatch the new link and then use it to open, say winamp. BTW, IE 5.5 does not alway's respond to the code above.. Dunno why. Sometimes it does. sometimes nothing happends whatsoever. Strange!

Ideas? Perhaps not a whole solution cause then I'll not learn. Thanx in advance! /FuzyToes

How To Disable Specific Column
how can i disable or make the specific column uneditable in using spreadsheets.

thanx!

SQL - Query For Value Associated With Only 1 Specific Value Of Another Column
Hi folks,

Sorry for the cryptic title I couldn't figure out a way to describe it shortly...

Basically I have a table like this...

ui_local_id
 u_id
 facility
 local_id

Sample data
u_id facility local_id
1001 FAC1 L100
1001 FAC2 L100
1002 FAC9 L123
1003 FAC1 L999
1003 FAC9 L321
1004 FAC1 L111
1005 FAC9 L200
1006 FAC9 L300
1006 FAC9 L400

What I want to do is return [u_id] where that value is only in the table once, and the value of [facility] is 'FAC9', so the values from the sample data returned would be 1002 and 1005.

Here's the SQL I'm using and it works reliably and well, but it can be a little slow. I think I remember doing something similar before with much cleaner SQL, but I can remember or find it now. Is this the "best" way to do this?
Code:SELECT u_id, facility, local_id
FROM ui_local_id
WHERE (facility = 'FAC9') AND (u_id IN
                          (SELECT u_id
                            FROM ui_local_id
                            GROUP BY u_id
                            HAVING (COUNT(u_id) = 1)))
EDIT: I forgot to mention: this is for SQL Server 2000, oops
Thanks for your help,


J KLMNOxI got my MVP
Math isn't so hard! 1 plus 1 always equals 10!

Edited by - lazyjay on 7/16/2004 11:26:55 AM

Key Capture And Handling For Specific Column
I'm trying to capture the del key so that when a user deletes data in column 11, the data is copied to a col 3 to the right... but at any other column, it should work as always ...
This is what I have so far:

(in the workbook)
Private Sub Workbook_Open()
Application.onkey "{del}", "doWork"
End Sub

(separate module)
Sub doWork()
'see if only single cell selected:
If (Selection.Columns.Column = "11") And (Application.CountBlank(Selection) + Application.CountA(Selection) = 1) Then
msgbox "del pressed!"
'copy 3 over to the right
else: 'do what del would usually do... but how?
End If
End Sub

Tooltexttips On A Specific Grid Column? Can This Be Done?
I'm currently using the AddCustomToolTip function (found on this forum) for toolTextTips on form objects. This works great for textboxes, buttons etc.. however i have a grid and i'd like to have mouseover popup info on each column. is this possible?

Add Varibles To A Specific Column {VSFlexGrid}
Whenever I use the ADD method to populate a column it always seems to go in only one coulmn.
For example if I have a String with "Hello" and a String with "GoodBye", when I add these to column one and column two, sperately they always seem to go into the same one. i.e

Col1 Col2
Hello ||
Goodbye ||

Instead of

Col1 Col2
Hello || Goodbye

This is my code, can anyone see an error??

Code:
Sub ApplicantFlexiSetup() ' setting the boundaries of the VSFSearch

x = 0

VSFlexGridSearch.ColWidth(0) = 2300

rst.Open "SELECT * FROM jobapplication", cnn, adOpenStatic, adLockReadOnly, adCmdText

While rst.EOF <> True

SearchBy = rst.Fields(1) & " " & rst.Fields(2) & " " & rst.Fields(3)
JobApplicationID = rst.Fields(0)

VSFlexGridSearch.ColHidden(0) = False
VSFlexGridSearch.ColSel = 0
VSFlexGridSearch.AddItem (JobApplicationID)
VSFlexGridSearch.ColSel = 2
VSFlexGridSearch.AddItem (SearchBy)

VSFlexGridSearch.ColAlignment(0) = flexAlignLeftCenter
VSFlexGridSearch.ColAlignment(1) = flexAlignLeftCenter

x = x + 1

rst.MoveNext

Wend

Menu.Width = 10700

rst.Close

End Sub
Thanks for your time

Sort A UDT Array By A Specific Column
If someone out there has a routine that does this, that would be mighty helpful...

(As an example)
Private Type MyStruct
SomeString As String
SomeNum As Integer
SomeDate As Date
End Type

Dim MyUDTArray() As MyStruct
...

Load up MyUDTArray with data in no particular order

...

Call your handy-dandy function to sort MyUDTArray on "SomeNum"

Sorting A Flexgrid By A Specific Column
Can anyone tell me how I sort my flexgrid by teh values in column 2 ?

Thanks in advance ...

Edit Specific Column In MSHFlexGrid.
I want to edit only column no 11 in my MSHFlexGrid but i need to know what is the specify syntax for that. I able code it as editable but it applies to all column. I m using textbox to manipulate the MSHFlexGrid cell. Here is my coding


Code:

Private Sub MSHF2_Click()

With txtEdit
UndoText = MSHF2.Text
.Text = MSHF2.Text
.Top = MSHF2.CellTop + 82
.Left = MSHF2.CellLeft + 80
.Width = MSHF2.CellWidth - 25
.Height = MSHF2.CellHeight
.Visible = True
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End Sub



Code:

Private Sub MSHF2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then MSHF2_Click

End Sub



Code:

Private Sub txtEdit_Change()

MSHF2.Text = txtEdit

End Sub

Datagrid Calculate Value In Specific Column
Hi,

How can you calculate the total of values from one specific column into a datagrid and return that value into text field automatically?

Here the fact...

I'm using Master/Detail Form..

Master fields are:
- phaseID
- Phase
- Totaltime

Detail fields are:
- timeID
- phaseID
- Time

So, i want to calculate the sum of Time and return the value into Totaltime.

Thanks for help !

How I Can Change The Backcolor Of Specific Column In DataGrid
How i can change the Backcolor of specific Column in DataGrid

Input From A Specific Column And Row In A Text File
hi,

I am trying to read and input data form a text file made of several columns and rows. I read somethign about "my reader" but I couldn't find the exact information.

Thanks
Hala

Finding A Specific Column(row?) On A MSChart (RESOLVED)
Greets,

I have a MSChart control all set up as a line graph, each point going from left to right is a differnt value on a different day. I thought I could put the days along the bottom of the graph, but as my data goes on for a couple years now, the dates are too close together to read. So I came up with the brilliant thought of having the date displayed as a tooltip when the mouse hovered over the graph. It worked quite well. I was able to get the date through a complex equation based off the distance between the left and right edges of the graph, the mouse's current x-position and relate that all back to my original database and get the date. Now, the only problem I have is that sometimes the text on the right side of the graph goes to 3 decimal places, and sometimes it goes to 4, and then sometimes it doesn't have any decimals at all. This changes the position of the right side of the graph and throws off my calculations. Is there some way to find out the x-position of the right side of the graph?

Here is the code I use for getting the date.

Code:
' The command buttons 2 & 3 are used to pick a date range.
SDate = "'" & Format(frmMain.cmdDateBtn(2).Caption, "mm/dd/yy") & "'"
EDate = "'" & Format(frmMain.cmdDateBtn(3).Caption, "mm/dd/yy") & "'"

' The next two lines get the absolute positions in the database for where the start and end dates are
FHRS.FindFirst "[Date]=" & SDate: FHistSDate = FHRS.AbsolutePosition
FHRS.FindFirst "[Date]=" & EDate: FHistEDate = FHRS.AbsolutePosition

' Days Diff is obviously the number of days between the start and end date
DaysDiff = FHistEDate - FHistSDate + 1

' 10845 is the x-position of the right edge fo the graph with 2 decimal places showing.
daydiv = 10845 / DaysDiff

' Gap is the gap that shows between the left and right edges of the graph, and the actual lines.
Gap = (daydiv / 2) + 100

' This rounds everything off to an integer so that the date can be found in the database.
DayNum = Round((x - Gap) / daydiv, 0)

' Then this finds the absolute position in the database based on the calculation and gets the date value
' and displays it as a tooltip
FHRS.AbsolutePosition = FHistSDate + DayNum
DateVal = Format(FHRS.Fields("Date").Value, "mmmm dd, yyyy")
chtFIFund(0).ToolTipText = DateVal & " X=" & x



If there were someway to maybe get the values on the right side of the chart to always be 3 decimal places? As long as I had a consistant number, the calc would be easy to do. Or is there some easier way to get the date information.

I should mention that the dates Arn't being plotted on the graph, what is being plotted is a value that happens on that date, so I can't pull the info from the ".data" value.

I'm also going to attach an example of my chart so people can see what I'm talking about.

If anyone has any idea, I would greatly appreciate it!



Edited by - Runescope on 7/22/2005 1:32:24 PM

DataGrid's Specific Column Keypress Event
Hi!
i am using DataGrid to display records. I want to update records by editing. in one specific column(Ex: Status) the default data is 'P' . when i press 'c' i want to control the keypress as upper case. Means if i press 'c', it should become 'C'. then i want to check it in beforecolupdate event.

Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
Dim Char As String 'C=67
   Char = Chr(KeyAscii)
   KeyAscii = Asc(UCase(Char))
End Sub

Private Sub DataGrid1_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)
Dim sR$, sC$ 'C=67 'R=82
Dim colpos As Byte
sR = Chr(82)
sC = Chr(67)
colpos = (DataGrid1.Columns("Status").ColIndex)

If ColIndex = colpos Then
    If ((DataGrid1.Columns("Status").Value <> sC) And (DataGrid1.Columns("Status").Value <> sR)) Then
         Cancel = True
         MsgBox "You must enter either 'C' OR 'R' only.", vbCritical, "Error in Entry"
      End If
   End If
End Sub

the problem is keypress event works for all colums. BeforeColUpdate event is also not working as i want.
if i modify only Status column then, BeforeColUpdate event is working.
So my question is how to control one specific column's value to upper and check it, because i am modifying 3 columns and checking only one column.
except this problem update is working . only thing is i have to enter Capital 'C' manually.

Help me
thanks
>>>>>>>>>>>>>>>>>



Edited by - sreddy on 4/5/2005 9:18:41 AM

To Add Column In The Table And Fill It With Specific Text
Hello Ppl..

I have a table in a DB. I want to add a column in that table and fill it with the data of a string. I am using MS access DB and VBA coding and doing this...

CurrentDb.Execute "ALTER TABLE [" & strTblname & "] ADD COLUMN PHICycle ' " & strPHICycle & "' "

Where [" & strTblname & "] is the table name
I want to name the column as PHICycle
I want to fill that column with the data of the string strPHICycle

But it gives error as "syntax error in field definition"

Plz Help..



Edited by - isayhello on 9/21/2005 3:10:02 PM

Deleting Rows With Empty Cells In A Specific Column
Hi

I have searched through the forums and found many threads about deleting rows in various circumstances, but my knowledge of VB is very basic and I have not been able to adapt anything to work properly.

My Problem:

Have an Excel worksheet with 7 columns (A:G) of data. I need to delete the entire row for any row that has a blank cell in column 6(F).

If someone has the time to write the exact code that I can copy and paste into my macro then I will be very greatful.

Thanks and Merry Xmas!

Rob

Keeping Selection Is VSflexgrid When Clicking On A Specific Column
Does anyone know how to keep the current row selections while allowing the user to click in a specific column to get further information on a row?

Im using a componentone VSFlexgrid and allow the user to highlight selected (but not necessarily adjacent) rows. I always need to allow them to double check details on a selected row by clicking a picture in the far right column without losing the rows they have already selected.

Is this possible...if so, can anyone enlighten me please?, nothing ive tried in the BeforeSelChange event seems to work (eg Cancel)

Cheers

&lt;resolved&gt; Reading Specific Column From Text File
Hello ppl and sorry if this question is too simple, I tried searching but there are too many posts about read and not one close to what I need.
I have a text file which contains line after line of th efollowing sample:

10-27-4-9-30-6 , A500-Q , 6/30/05 1:59:51 PM

I am trying to read the first part (10-27-4-9-30-6) and feed it into a listbox using addItem.
I don't seem to be able to do it.

My code is:

Code:
Dim N1, N2, N3 As String
Dim NNumberLList As String
NNumberLList = "C:NN.txt"
Open NNumberLList For Input As #1

Do While Not EOF(1)
Input #1, N1, N2, N3
lstList.AddItem N1
Loop
Close #1


Any suggestions?

How To Read An Excel Spreadsheet Column, That Is, Read From The Top Cell To Bottom Cell (like File R
How to read an excel spreadsheet column, that is, read from the top cell to bottom cell (like file read to eof)? how can I know which cell is the last cell?

thanks

Read Specific Line
Can someone tell me how to read the line that start with "03" in a file?
Thks in advance

Read Specific Line
Hi,
In my current project I need to load ever first and every fifth text line (from a txt file for example) to 2 textboxes

However the current code I use only allows me to but all the 10 lines to 10 texboxes and use it after that.
So as far as I know this code is only usable to load either every line to a seperate textbox, or to get the first line from a text file

My current code is:

Private Sub File1_Click()
Open File1.Path + "" + File1 For Input As #1
Line Input #1, a1
Line Input #1, b1
Line Input #1, c1
Line Input #1, d1
Line Input #1, e1

Text1.Text = a1
Text2.Text = b1
Text3.Text = c1
Text4.Text = d1
Text5.Text = e1
End Sub

Hope you can help

tnx in advance,

Maartuh03

How I Can Read A Specific Sector In A Cd-rom?
Hello everybody,
how I can read a specific track in a cd-rom through VB?
For example:
if I need to read the data contained in a specific zone of the cd-rom, can I pilot the head of the CD for read only that zone?
and if is possible, how?

thank you

Read A Specific Line
Hi i have a text file and i would like to read a specific lines in that file. any one with ideas on how i can do that?

Thanks

Read Specific Line
Hello,

I'm looking at writing a password generator that uses real words. In order to do this I've downloaded a relatively small dictionary text file, about 80K words (600kb), with a word-per-line.

Now, my problem is what is the best way to pick a word out of this file randomly, preferably with FSO?

Currently I count the number of lines in the file and use a random number generator to pick a number within the lines-of-file range. This is where I run into problems/issues. I can read each line into an array, and access the random element as required, but is this the best/most efficient way for such a large number of lines?

Thanks.

Read Specific Bytes At An Offset
I need to read a few bytes at a specific offset, say for example the first 10 bytes of the file. I also need to write to a specific offset... This is for patching a file.

Example of what i need this information for:
(function breakdown)
Check for file -> Check File Size -> Check Bytes* -> Check if file is writable -> Write Log

I appreciate any posts to help me out here, sorry if this is a newbie question. Im not that educated with VB File I/O.

How To Read A Specific Line From Txt File?
I wan't to read lats say, line 5 how can I do it?


BTW:
How can I know the end (number) of array?
Or how can I check if array1(3) is ok? (If it's exist)

Read Line Until Specific Character
I'm trying to read in some lines from a text file but the only part I want is a number located at the beginning of the line, after the text is a space and then some text. How would I go about reading in only the number and stopping when I get to the space??

Read A Specific Character From An Array
I've this code:

Code:
Dim buffer As String
Dim bufferarray() As String
Open App.Path & "datasettingslicense.ini" For Input As #1
Line Input #1, buffer
Close #1
bufferarray() = Split(buffer, "-")
Now bufferarray(0) = "AGBS1"
I only need the "1" from this array. Does anyone knows how I can select just the "1" out of the array?

Thanx in advance.

Read File From Specific Point To The End??
I am attempting to read a file and write what I read to the end of another file. My problem is that I do not want to read the first part of the file I am reading. I need to find a "keyword" which tells me where to start reading and writing the information to the other file. Here is my code.... this code opens one file for reading and then writes the whole file to the end of the other file?

Do I need to do this line by line to accomplish what i need? The problem is the file i am reading is an extremely long html file.

dim fso as new FileSystemObject
Dim file as file
dim filetocopy as file
dim textstream as textstream
dim newTextstream as textstream

Set file = fso.GetFile(MyfilePath.html)
set filetocopy = fso.getfile(MyFileToCopy.html)
set textstream = file.OpenAsTextStream(ForAppending)
set newTextstream = file.OpenAstextStream(ForReading)
textstream.write newtextstream.readall
textstream.close
newtextstream.close
set file = nothing
set fso = nothing


Any suggestions

Thanks,

M

Read Only Status For A Specific People??
Hi,
I have been working on Excel VBA. I wanted to know whether there is any way that the excel spreadsheet status can be set to readonly for a specific group of users ??

How Do I Read Specific Memory Addresses??
I have a DLL that I am using with my VB program. It works great, but a few of the commands don't have return parameters, but instead a memory address.

For instance, when you want to request the Version you send the DLL "?" and it returns the version in rev%.

There are two commands that I need to use, the "^" and "&", but they do not have return parameters. They specify the following addresses:

"^" Address 0x002e

"&" Address 0x0030

How do I read these??

Any help greatly appreciated!

Need To Set Specific Cells In A Word Table To Read Only
Hello!

I am a VB developer that was suddenly thrust into the situation of having to make some changes to some word templates that are populated from a CRM package.

The request that was put before me was to set up a table in a word template where some cells will be auto populated and others need to be set to read only.

If this is possible, can someone please point me in the right direction?

Many Thanks :-)

How To Read Text File Of Specific Location?
Suppose I have the following text file:

Apple USA
Orange HK
Pear Japan
Grape Australia
Mango Thailand

I want to write a program, then user will input a query. For example, the user enter "Orange", then the program will read the text file, find the line which have "Orange" and then output "HK".

Is there anyway to read a line in text file only, which contain the query word. Because the file contains > 15000 lines, I don't want the program read the file line by line...... I want a faster method to get the line~~~

Thx

Read A Specific Line From Big Text File
How can I read specific line from big *.TXT file?
For example *.TXT file size is 200MB and I want read specific line from this file how can I do that ?

Read USB Drive And Copy Specific Files
Hi....
I am new to VB...I was wondering how to make an application which reads a USB drive when inserted and copy a single file or multiple files with a fix extension (e.g. *.doc) from the USB drive to local hard disk whenever the USB drive is inserted to the USB port...

any help and suggestion will be greatly appreciated....

thanks

Read From Specific Line In Text File
How can I read and write to a specific line in a textfile.

Say I want to write a string to say line 5 into info.txt and later I want read line 5 from info.txt

thanks Vidar

Make Specific Datagrid Columns Read Only
hi my question is that i want to make a datagrid which has first two columns readonly where as the other columns are used like text boxes for data entry

Read Specific Line Of Multiline Textbox?
I've only been working with VB for a very short time. I'm trying to read a specific line of a multiline text box. For example, I wish I could do something like this:

Dim Line4Data

Line4Data = txtBox.Text (line = 4)

Is there an easy solution to this? Everything I've read starts talking about SQL databases and blows my mind.

Thanks.

How To Read The Records In A File Into A Specific Control Array??
Hai guys,

I want to know whether there is any way of reading the contents of a file the records into a specific control array of text boxes??? If you dont get the problem then I am happy to explain it again.

The main problem is not the reading of the file I can do it properly but getting the particular record and then having it displayed on a specific text box which is in a control array by the click of a button. Please help


darkshade

How To Read Specific Excel Cell Value Into Integer Variable?
Hi,

How to read specific excel cell value into integer variable?

How Do I Read A SPECIFIC Line From A Text File ?? GURUS PLEASE HELP =)
A few easy questions for you gurus =)

1. How would I read a specific line from a textfile (for example line number 5)

2. How would i read a specific value in a text file? Lets say the file looks like an ini file:
thing1=value1
thing2=value2

How would i read/write from the specific value?? PLEASE HELP!!!!
Is it possible to search for a string in a file without loading it in a textbox? How would i then extract the value of thing2 for example then???

How Would I Read A Specific Line From A Text File As A String?
I would like to read configuration from a text file like config.txt
each line would look like: variable value (for example: version "0.9")

What code would i need to write if i only wanted to extract one variable and it's value from the config.txt?

How would i find the variable and read it's value ????


---------------------
~:{Decayed}:~
the.decayed@usa.net
http://www.q3seek.com

Read-Only Column!!!
i keep getting an error saying:

"Run-Time erro '7010': The column is read-only."

i am running a search in a database that populates a datagrid...if i wanted to change a field this is the error it gives me...any suggestions?...thanks for your time...

Column Is Read Only
Hi all,
VS2008 SQL Server 2005.
I am having a problem with a datatable. I have a table with 3-4 varchar(max) columns. Using VS I created a select, insert and update stored procedure. There is a param sent to the sproc. I use a rich text box control to contain the data. I have had no luch binding the data to the control so I use rtDesc.Text = EMDVisit.ov_Discomfort.Rows(0).Item(1).ToString to display the data. On the lost focus event I use:
EMDVisit.ov_Discomfort.Rows(0).Item(1) = rtDesc.Text.ToStringAt this point I get an error message that states the column is Read Only.
How can this be? I have another rich text box coded the same way and it works.
I have not done any development in a while and this is my first attempts with VS 2008.
I really would like to get this resolved and I hope that someone can point out my problem
TIA,
Roy

READ ONLY COLUMN
Can anyone tell how to make a column in datagrid as readonly - not all columns, just selected columns. And also how to update records in datagrid that are initially Null.

Thanks,
Bhavesh S.

(Rate this post if it helped you)

Bhavesh Shah
Kansas State University
Manhattan, KS
shah_bhavesh_in@yahoo.co.in

Read Only Column In Dg
Can anyone please tell how can we make one column in datagrid as read only column while other column is not read only (that is we can update the second column)

Also is there any method to move the cursor to next row by hitting tab when we come to end of first row.

Thanks,
Bhavesh Shah.

(Rate this post if it helped you)

Bhavesh Shah
Kansas State University
Manhattan, KS
shah_bhavesh_in@yahoo.co.in

Follow-up To Tutorial: Files -&gt; How To Read And Write Specific Records From/To A File
I understand all of the information in the FAQ that Xtab provided, but I also need the follow-up info containing this:

Quote:Although this is quite a long document, there are some areas we still haven't covered - the Seek and Loc Functions, deleting Records and searching for a Record containing a specific string, for example. Hopefully these will be covered in a follow-up FAQ, but at least for now you have the basics you need to be able to read and write to a Random Access file.


Greatly appreciated guys!

If ever you need me, just look to the sky and shout my name.
~The Cloudman~

How To Read Specific Excel Range Data Into Datagrid Using Two Date Values?
Hi,

Below is the code that reads a row of Excel data from an Excel File into Visual Basic.NET program datagrid, the code only reads one row of data. I want to add more functionality to the program, on the first column of each rows in the Excel file is date, by adding two datetimepicker in the VB.NET program one listed as start date and other end date. I would like datagrid to return all the data between this two dates, I have trying various scenarios but all unsuccessful. Hope someone can help me.


  Dim oExcel As Object
  Dim i As Integer

        Dim ds As New DataSet
        ds = DataSet1
        ds.Clear()
        DataGrid1.DataSource = Nothing

        oExcel = CreateObject("Excel.Application")

        Dim dr As DataRow
        oExcel.Workbooks.Open(Application.StartupPath & "MyExcel.xls", , False)


        With oExcel.WorkBooks("MyExcel.xls").Worksheets(cmbBox2.SelectedItem)

            dr = ds.Tables("Table1").NewRow

            dr.Item("Date") = .Cells(1, 1).Value
            dr.Item("Min Price") = .Cells(1, 2).Value
            dr.Item("Max Price") = .Cells(1, 3).Value
            dr.Item("Closed Price") = .Cells(1, 4).Value
            dr.Item("Change") = .Cells(1, 5).Value
            dr.Item("Volume") = .Cells(1, 6).Value
            dr.Item("Foreign Inv.") = .Cells(1, 7).Value
            dr.Item("Securities Trust Co.") = .Cells(1, 8).Value
            dr.Item("Dealers") = .Cells(1, 9).Value

            ds.Tables("table1").Rows.Add(dr)

        End With

        Me.DataGrid1.DataSource = ds.Tables("table1")
        Me.DataGrid1.Refresh()

        oExcel.WorkBooks("MyExcel.xls").Close(True)
        oExcel.Quit()
        oExcel = Nothing
        GC.Collect()



Edited by - roniwu on 11/13/2005 6:04:22 AM

Read Excel Column
Hi i want to read the contents of an excel column and write the contents to a Database.

any one who can help me out?

Copyright © 2005-08 www.BigResource.com, All rights reserved