-=-
.
.....
  
 
RSS
Direkomendasikan menggunakan brower Opera/Chrome/Firefox. Resolusi minimal 1024x768 | Powered by ____ |
 
  
 
Nikmati Delphi-ID dalam berbagai versi tampilan :
Basic View (LOW Bandwidth)
Default View (Full)
Mobile Edition
Main Menu
..:: onWebTools ::..
..:: onLastPosts ::..
goto Postjumlah komponen maksimal dalam sebuah project(6)
 by d4mnf1y32
 on 21.May at 12:16
goto Posttanya grayscale to biner dengan scanline(1)
 by luckynvic
 on 20.May at 20:44
goto Posttanya looping biner to matriks(1)
 by luckynvic
 on 20.May at 20:10
goto Postsql error:acces denied for user....(2)
 by nasbms
 on 19.May at 16:54
goto Postpemanggilan frame(4)
 by nasbms
 on 19.May at 16:14
goto Posttanya AvLock(0)
 by azuriza
 on 19.May at 11:24
goto PostGet TDBEdit Value Menggunakan LookUp Grid(10)
 by henry_sys
 on 18.May at 11:27
goto Postmenghitung record dalam perulangan(4)
 by idhiel
 on 16.May at 13:53
goto Posttanya ascii(4)
 by mas_kofa
 on 16.May at 12:11
goto PostRawPrint Untuk Delphi XE2(0)
 by adewijaya
 on 15.May at 22:34
goto Postdatabase error..(4)
 by idhiel
 on 15.May at 15:57
goto Postbekasi, pt arila putra mahkota(3)
 by mas_kofa
 on 15.May at 15:37
goto Postbagaimana cara membaca file *.doc dg delphi?(0)
 by ficky
 on 15.May at 06:14
goto Posttanya biner to matriks(13)
 by diandewi
 on 14.May at 20:30

..:: onLast Articles ::..
..:: New Download ::..
Pascal-id.Org
Feeds -  Popular -  Latest
RE: The Longue
8 months, 3 weeks ago
RE: belajar pascal
8 months, 3 weeks ago
RE: The Longue
8 months, 3 weeks ago
RE: belajar pascal
8 months, 3 weeks ago
RE: Perkenalan dan Absen
8 months, 3 weeks ago
RE: Alhamdulillah Buka Puasa Bersama
8 months, 4 weeks ago
RE: تَقَبَّلَ اللهُ مِنَّا وَمِنْكَ - Selamat Hari Raya Idul Fitri
8 months, 4 weeks ago
Lintas Situs
«
free web site stats and visitor tracking

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
radhutzOffline
Location:
Post subject: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 13:07
onIntermediate


Joined: 02-Sep-2009
Posts: 33

Status: Offline
hi, delphiers..
saya mau nanya cara memasukkan nilai ke dalam tabel database..
coding saya seperti ini

var n,i : integer;
n:=stringgrid1.RowCount;
for i:=1 to n do
begin
query1.Active:=false;
query1.SQL.Clear;
query1.SQL.Add('insert into tabel ([A],[B])'+
'VALUES("'+stringgrid1.Cells[0,n]+'","'+stringgrid1.Cells[1,n]+'")');
query1.ExecSQL;
end;

coding ini berhasil namun sayangnya nilai tidak ada yang masuk ke dalam tabel tapi hanya baris kosong saja..

tolong bantuannya..
terimakasih..
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
jrpOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 13:25
onKnowledgeable


Joined: 12-Sep-2006
Posts: 198

Status: Offline
Coba sebelum Query1.ExecSQL jalankan ShowMessage(Query1.SQL.Text) supaya anda bisa melihat apakah SQL yang dihasilkan oleh loop tersebut sudah benar atau belum.

jrp
 
 View user's profile Send private message  
Reply with quote Back to top
radhutzOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 13:35
onIntermediate


Joined: 02-Sep-2009
Posts: 33

Status: Offline
iya, mas..
ternyata mang ada error di coding setelah values..
dy nunjukkin ga ada nilai di sg-nya, padahal nilainya ada, dan berupa teks..
setau saya, klo berupa string kayak gitu.. ada tanda petik " abis ntu tanda ' baru tanda +..
kalo boleh tanya lebih lanjut, berarti apa ya codingnya??
coz setau saya hanya itu..
tararenqyu..
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
jrpOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 13:51
onKnowledgeable


Joined: 12-Sep-2006
Posts: 198

Status: Offline
Kalau begitu, mungkin ada yang belum beres pada saat mengambil nilai dari StringGrid (seperti stringgrid1.Cells[0,n]). Silahkan dicoba dengan loop sederhana yg men-ShowMessage isi StringGrid.Cells yang bersangkutan.

Mengenai pengunaan tanda petik ganda, itu tergantung komponen data access apa dan juga database server yang anda gunakan. Ada yang mau petik ganda, ada yang mau petik tunggal, dan ada yang mau keduanya. Jika tidak terjadi error, kemungkinan besar tidak ada masalah dengan tanda petik ganda tersebut.

jrp
 
 View user's profile Send private message  
Reply with quote Back to top
radhutzOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 14:02
onIntermediate


Joined: 02-Sep-2009
Posts: 33

Status: Offline
ternyata ga ada isinya, mas.
berarti eror dimananya?
coz pas dirunning isinya ada..
atau di properties stringgridnya??
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
jrpOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 12/Oct/2009 21:41
onKnowledgeable


Joined: 12-Sep-2006
Posts: 198

Status: Offline
Halo radhutz,

Tinggal sedikit lagi koq pasti anda bisa menemukan jawabannya Smile Coba lihat post saya di atas, ada sedikit petunjuk (seperti stringgrid1.Cells[0,n]) coba deh dibandingkan dengan loop yang anda lakukan... ada salah ketik sedikiiiiiiiiit saja.

Selamat mencoba ya...saya yakin anda lebih senang diberi kail daripada diberi ikan.

jrp
 
 View user's profile Send private message  
Reply with quote Back to top
jrpOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 15/Oct/2009 14:29
onKnowledgeable


Joined: 12-Sep-2006
Posts: 198

Status: Offline
Bagaimana radhutz, sudah bisa?

Cuma sedikit salah ketik (semantik): yang harusnya i ditulis n.

pada:

stringgrid1.Cells[0,n]

dan

stringgrid1.Cells[1,n]

Sebabnya, karena anda melakukan loop for i:=1 to n do... jadi yg harusnya di referensi dalam loop adalah i bukan n.

jrp
 
 View user's profile Send private message  
Reply with quote Back to top
n3o_cybertech
Location: NgAyUkYoKarTo
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 16/Oct/2009 11:19
onProfessional


Joined: 10-Feb-2007
Posts: 993
Location: NgAyUkYoKarTo
neh ada tutorialnya http://programminglearning.wordpress.com/2009/05/15/delphi-penyimpanan-data-ke-database-secara-massal/

_________________

Delphi Rock!

Blog : MyBlog | Facebook : Add Me :)
 
 View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger  
Reply with quote Back to top
radhutzOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 02/Dec/2009 14:19
onIntermediate


Joined: 02-Sep-2009
Posts: 33

Status: Offline
maaf, saya baru buka lagi.
terimakasih, mas jrp atas bantuannya..
iya, saya baru ngeh salah..
hehehe..
sekali lagi, makasih 4 all delphiers..
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
radhutzOffline
Location:
Post subject: RE: memasukan nilai string grid ke dalam tabel database  PostPosted: 02/Dec/2009 14:34
onIntermediate


Joined: 02-Sep-2009
Posts: 33

Status: Offline
sudah berhasil.. Very Happy
 
 View user's profile Send private message Send e-mail Yahoo Messenger  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic





Powered by PNphpBB2 © 2003-2009 The Zafenio Team
Credits


| Register | Lost Password ? |