G
Guest
Hi,
I am getting some data from a .csv file through an aspx page. The total no
of records are 744 while i'm getting 1500. I couldn't really figure it out.
I'll write the code below.
Can anybody please let me know what am i doing wrong over here. Also is
there any method in ado.net like ado (Recordset.EOF) because i couldn't find
any method like this as well.
Thanks in advance.
I am getting some data from a .csv file through an aspx page. The total no
of records are 744 while i'm getting 1500. I couldn't really figure it out.
I'll write the code below.
Code:
Dim ExcelConnection As New OleDbConnection
Dim ExcelCommand As New OleDbCommand
Dim ExcelAdapter As New OleDbDataAdapter
Dim ExcelDataset As New DataSet
ExcelConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathname +
";Extended Properties=Text;")
ExcelConnection.Open()
ExcelCommand = New OleDbCommand("SELECT * FROM " + filename,
ExcelConnection)
Dim myread As OleDbDataReader
ExcelAdapter = New OleDbDataAdapter(ExcelCommand)
myread = ExcelCommand.ExecuteReader
'If myread.HasRows Then
Dim sqlConn As SqlConnection
sqlConn = New SqlConnection("Server=.;database=Nissan; User Id=sa;
Password=testing")
Dim sqlcmd As New SqlCommand
sqlConn.Open()
While myread.Read
'sqlcmd.CommandText = "Insert imported (imp) values('" &
myread.GetValue(5) & "')"
'sqlcmd.Connection = sqlConn
'sqlcmd.ExecuteNonQuery()
Response.write (myread.getvalue(5))
Response.write("<BR>")
End While
sqlConn.Close()
Can anybody please let me know what am i doing wrong over here. Also is
there any method in ado.net like ado (Recordset.EOF) because i couldn't find
any method like this as well.
Thanks in advance.