help
-
hi, I am Rana I am using vb.net to accomplish following task: 1) read a csv file from hard disc 2) display it on DataGridView 3) use the datagridview to update an existing access dataset table which has exactly same number of fileds as input csv file displayed in datagridview 4) add query to the updated datset table 5) exporting the result to a text file So far I cud only hab done until step 2. I desperately need help on rest of 3 steps. Here is my code: Code Block: Imports System.IO Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then Dim fi As New FileInfo(OpenFileDialog1.FileName) Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=" & fi.DirectoryName Dim objConn As New OleDbConnection(sConnectionString) Dim objDataSet As DataSet = New DataSet() objConn.Open() Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fi.Name, objConn) Dim objAdapter1 As New OleDbDataAdapter objAdapter1.SelectCommand = objCmdSelect objAdapter1.Fill(objDataSet, "test") DataGridView1.DataSource = objDataSet.Tables(0).DefaultView objConn.Close() End If End Sub End Class Please help me on how i can do above three things ASAP.
-
hi, I am Rana I am using vb.net to accomplish following task: 1) read a csv file from hard disc 2) display it on DataGridView 3) use the datagridview to update an existing access dataset table which has exactly same number of fileds as input csv file displayed in datagridview 4) add query to the updated datset table 5) exporting the result to a text file So far I cud only hab done until step 2. I desperately need help on rest of 3 steps. Here is my code: Code Block: Imports System.IO Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then Dim fi As New FileInfo(OpenFileDialog1.FileName) Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=" & fi.DirectoryName Dim objConn As New OleDbConnection(sConnectionString) Dim objDataSet As DataSet = New DataSet() objConn.Open() Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fi.Name, objConn) Dim objAdapter1 As New OleDbDataAdapter objAdapter1.SelectCommand = objCmdSelect objAdapter1.Fill(objDataSet, "test") DataGridView1.DataSource = objDataSet.Tables(0).DefaultView objConn.Close() End If End Sub End Class Please help me on how i can do above three things ASAP.
Sorry, but this has "homework assignment" written all over it. We're not going to write your code for you. You wouldn't learn anything that way. Everything you need has already been covered in your class.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Sorry, but this has "homework assignment" written all over it. We're not going to write your code for you. You wouldn't learn anything that way. Everything you need has already been covered in your class.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Hello Dave Kreskowiak, please believe me its not a homework assignment. actually I am doing it as a part of the development. I have been trying : objAdapter1.Update(Me.Db1DataSet.Sheet1) but its not working. I just want your help on updating the database with this datgridview that's all. Rest I can do. Please help me!
-
Hello Dave Kreskowiak, please believe me its not a homework assignment. actually I am doing it as a part of the development. I have been trying : objAdapter1.Update(Me.Db1DataSet.Sheet1) but its not working. I just want your help on updating the database with this datgridview that's all. Rest I can do. Please help me!
rajulama wrote:
I just want your help on updating the database
A word of advice, the verb to Want is too abrasive to use when you are the one making a request from a position of weakness. It's better to use the subjective, i.e. "would like". Same principal I know applies in Spanish and German and I would expect to be fairly universal. Put simply it's the polite way to make a request of somebody you have no authority over. Not that it'll help you here, mind. Also, for the love of God, use a decent naming system!
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
-
rajulama wrote:
I just want your help on updating the database
A word of advice, the verb to Want is too abrasive to use when you are the one making a request from a position of weakness. It's better to use the subjective, i.e. "would like". Same principal I know applies in Spanish and German and I would expect to be fairly universal. Put simply it's the polite way to make a request of somebody you have no authority over. Not that it'll help you here, mind. Also, for the love of God, use a decent naming system!
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
-
sorry, I would be really grateful to you if you could help me. Please don't mind. Help me out, please!
MidwestLimey was correct and you're still not quite getting it. It's not polite to ask for help and then in the same request demand it with an exclamation mark. So lets practice as if you were going to ask for help from Dave, you could try kissing his a$$ a little like: "Dave the almighty who rules next to Xerxes - could you find it in your gracious heart to feel pity upon my disgraced soul and help me with my problem? I am nothing without your assistance and bow before your presence." Or...........you could simply ask for help without it demanding, caps, or !s. Your problem does kind of look like a homework assignment.
Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison
-
MidwestLimey was correct and you're still not quite getting it. It's not polite to ask for help and then in the same request demand it with an exclamation mark. So lets practice as if you were going to ask for help from Dave, you could try kissing his a$$ a little like: "Dave the almighty who rules next to Xerxes - could you find it in your gracious heart to feel pity upon my disgraced soul and help me with my problem? I am nothing without your assistance and bow before your presence." Or...........you could simply ask for help without it demanding, caps, or !s. Your problem does kind of look like a homework assignment.
Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison
Jon_Boy wrote:
"Dave the almighty who rules next to Xerxes - could you find it in your gracious heart to feel pity upon my disgraced soul and help me with my problem? I am nothing without your assistance and bow before your presence."
OK, OK, I don't need to be wiping your lipstick off my ass! :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hello Dave Kreskowiak, please believe me its not a homework assignment. actually I am doing it as a part of the development. I have been trying : objAdapter1.Update(Me.Db1DataSet.Sheet1) but its not working. I just want your help on updating the database with this datgridview that's all. Rest I can do. Please help me!
rajulama wrote:
but its not working
If you want help, you have to give more information. What isn't working? What error message are you getting? Show us what code you have so far. We're not going to do your work for you, but if you have a specific problem we can try to point you in the right direction to get help.
-
rajulama wrote:
but its not working
If you want help, you have to give more information. What isn't working? What error message are you getting? Show us what code you have so far. We're not going to do your work for you, but if you have a specific problem we can try to point you in the right direction to get help.
If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
Dim fi As New FileInfo(OpenFileDialog1.FileName)
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=" & fi.DirectoryName
Dim objConn As New OleDbConnection(sConnectionString)
Dim objDataSet As DataSet = New DataSet()
objConn.Open()
Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fi.Name, objConn)
Dim objAdapter1 As New OleDbDataAdapter
objAdapter1.SelectCommand = objCmdSelect
objAdapter1.Fill(objDataSet, "test")
DataGridView1.DataSource = objDataSet.Tables(0).DefaultView
objConn.Close()
End IfI have this and now to replace the data in existing database with that in datagridview I am using:
objAdapter1.Update(Me.dataset.filename)
But its not making any change in dataset table.rest is ok.
-
If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
Dim fi As New FileInfo(OpenFileDialog1.FileName)
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=" & fi.DirectoryName
Dim objConn As New OleDbConnection(sConnectionString)
Dim objDataSet As DataSet = New DataSet()
objConn.Open()
Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fi.Name, objConn)
Dim objAdapter1 As New OleDbDataAdapter
objAdapter1.SelectCommand = objCmdSelect
objAdapter1.Fill(objDataSet, "test")
DataGridView1.DataSource = objDataSet.Tables(0).DefaultView
objConn.Close()
End IfI have this and now to replace the data in existing database with that in datagridview I am using:
objAdapter1.Update(Me.dataset.filename)
But its not making any change in dataset table.rest is ok.
-
Hello Dave Kreskowiak, please believe me its not a homework assignment. actually I am doing it as a part of the development. I have been trying : objAdapter1.Update(Me.Db1DataSet.Sheet1) but its not working. I just want your help on updating the database with this datgridview that's all. Rest I can do. Please help me!
rajulama wrote:
please believe me its not a homework assignment
Ok, I'll take your word
rajulama wrote:
actually I am doing it as a part of the development.
If I can not get my work done at my job, then I'll have to face the reality. Shouldn't you?
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
-
Jon_Boy wrote:
"Dave the almighty who rules next to Xerxes - could you find it in your gracious heart to feel pity upon my disgraced soul and help me with my problem? I am nothing without your assistance and bow before your presence."
OK, OK, I don't need to be wiping your lipstick off my ass! :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
+5 for the wit, -5 for not wanting a little lipstick on the ass.
If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
Dim fi As New FileInfo(OpenFileDialog1.FileName)
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=" & fi.DirectoryName
Dim objConn As New OleDbConnection(sConnectionString)
Dim objDataSet As DataSet = New DataSet()
objConn.Open()
Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fi.Name, objConn)
Dim objAdapter1 As New OleDbDataAdapter
objAdapter1.SelectCommand = objCmdSelect
objAdapter1.Fill(objDataSet, "test")
DataGridView1.DataSource = objDataSet.Tables(0).DefaultView
objConn.Close()After this I wrote:
objAdapter1.Update(Me.Db1DataSet.Sheet1("test"))
Because the dataset that I want to update is in by DB1DataSet.Sheet1. I dont want to update the datagridview itself. I want to update an existing database called DB1DataSet.Sheet1 from the datagridview. when I wrote above line its says following error:
Error 1 Overload resolution failed because no accessible 'Update' can be called with these arguments:
'Public Function Update(dataTable As System.Data.DataTable) As Integer': Value of type 'WindowsApplication1.db1DataSet.Sheet1Row' cannot be converted to 'System.Data.DataTable'.
'Public Function Update(dataRows() As System.Data.DataRow) As Integer': Value of type 'WindowsApplication1.db1DataSet.Sheet1Row' cannot be converted to '1-dimensional array of System.Data.DataRow'.
'Public Overrides Function Update(dataSet As System.Data.DataSet) As Integer': Value of type 'WindowsApplication1.db1DataSet.Sheet1Row' cannot be converted to 'System.Data.DataSet'.