please tell the code to select all the columns starting with same letter in asp.net using vb actually my query is working in sql server but i want to know the syntax which works in .net using vb
code to select columns stsrting with same letter
Collapse
X
-
Tags: None
-
Hi,
You can try this code,
con.ConnectionS tring = "Provider=SQLOL EDB.1;Persist Security Info=True;User ID=sa;password= ;Initial Catalog=Pubs;Da ta Source=."
con.Open()
da = New OleDbDataAdapte r("Select * from Authors", con)
da.Fill(ds)
Dim col(10) As DataColumn
Dim i As Integer = 0
For Each c As DataColumn In ds.Tables(0).Co lumns
If UCase(c.ColumnN ame).StartsWith ("A") Then
col(i) = c
i = i + 1
End If
Next
con.Close()
Is it the same thing you are looking for?
Comment