Hi I am learning .net and i am trying to read csv to dataset and display the results in grid which it working fine. But i want to use the values. I know its a dumb question but gotta start somewhere :|
Sample CSV
=============
"Name,Mobile"
"Jaaaaa Naaaa Al-Muuuuy,7000108"
"Jbbbbb Nbbbb Al-Mbbb,7444108"
======================
and keeps going on for 700 more lines.
*Note: if i Ctrl + H the csv and remove the "" they show up in two columns. I think there is Regex to remove the "".
I can see these in dataset just fine but in just one column. So i know i have to use split with "," but i cant seems to find the right syntax... here's the code below :-
Now end of the day i basically need two varible of same person i.e Name & Tel like (name) and (tel) which i can call in a software. .i.evb.net Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Text;Data Source=c:\" Dim objConn As New OleDbConnection(sConnectionString) objConn.Open() Dim objCmdSelect As New OleDbCommand("SELECT * FROM tel.csv", objConn) Dim objAdapter1 As New OleDbDataAdapter objAdapter1.SelectCommand = objCmdSelect Dim objDataset1 As New DataSet objAdapter1.Fill(objDataset1, "PhoneBook") DataGridView1.DataSource = objDataset1.Tables(0).DefaultView objConn.Close() End Sub
client.QueryString.Add("name", name)
client.QueryString.Add("to", tel)
I am trying something like this to split which is not working :-
vb.net Code:
For i = 0 To objDataset1.Tables(0).Rows.Count - 1 Dim cResult As String = objDataset1.Tables(0).Rows(i).Item(0) Dim cleanResult = Split(cResult, ",") MsgBox(cleanResult) Next i
Can anyone point me to rite direction.![]()




Reply With Quote