15,904,497 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Hendi Hermawan (Top 4 by date)
Hendi Hermawan
23-Sep-16 1:28am
View
ok, thnx for ur advice mika :) , ill try then... :)
Hendi Hermawan
22-Sep-16 23:42pm
View
yes true mika, im fetch data into single string variable and use a comma as delimiter between items.
im still confused mika :)
if this can be solved, this maybe be great idea for create very dynamic datagridview. just 1 form and 1 datagrid will be create a lot of report :)
Hendi Hermawan
22-Sep-16 23:27pm
View
thnx mika for ur answer but thats not my solution, this my full code, i hope u will understand with my code :)
Sub caridata()
dt.Clear()
Call koneksi()
Dim SqlQuery As String = "SELECT * FROM " & Label4.Text & " where Tanggal >= @dtawal and tanggal <= @dtakhir"
With cmd
.Parameters.AddWithValue("@dtawal", Format(DateTimePicker1.Value, "yyyy-MM-dd"))
.Parameters.AddWithValue("@dtakhir", Format(DateTimePicker2.Value, "yyyy-MM-dd"))
.CommandText = SqlQuery
.Connection = conn
End With
With adapter
.SelectCommand = cmd
.Fill(dt)
End With
Try
Call koneksi()
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "select * from tbllaporan2 where [caption form]='" + Me.Text + "'"
Cari2 = cmd.ExecuteReader
If Cari2.HasRows = True Then
Cari2.Read()
Dim asalfield, arrow(), union As String
asalfield = Cari2("Asal Field")
arrow = asalfield.Split("|")
DataGridView1.Rows.Clear()
With DataGridView1
For a As Integer = 0 To arrow.Length - 2
union = union + " dt.Rows(i)(""" + arrow(a) + """),"
Next
MsgBox(Len(union))
End With
For i = 0 To dt.Rows.Count - 1
Dim t = Len(union) - 1
Dim z As String = Microsoft.VisualBasic.Left(union, t)
'MsgBox(z)
DataGridView1.Rows.Add(z)
'dt.Rows(i)("Nomor"), dt.Rows(i)("Tanggal"), dt.Rows(i)("Nama Tercetak"), dt.Rows(i)("Qty"), dt.Rows(i)("Harga"), dt.Rows(i)("Jumlah"), dt.Rows(i)("Paid Status")
Next
cmd.Parameters.Clear()
Else
Label4.Text = ""
End If
conn.Close()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Hendi Hermawan
22-Sep-16 22:34pm
View
is there any way that the string can be executed in rows.add ()?
I want to string sql query result of which I keep in a string z can execute in rows.add ()
thnx for ur help Dave