Arsip: SQL Query Error-where=(fieldnya integer)

more 13 years ago
abu_nawm
mau tanya dunk,,,dah mentok nih
saya punya query seperti ini
'update produk set kode_pendaftar = "'+edit2.Text+'",jenis_produk = "'+combobox1.Text+'" where no_record = "'+edit1.text+'"';
pas di jalanin ko masih eror ya...
pesan errornya kaya begini :
'Parameter Edit1 has no default value'
tipe field no_record = number,
mungkin ga sich errornya disebabkan karena tipe field no_record nya number bukannya text ???
solusinya gimana yach..
thanks

more 13 years ago
mas_kofa
terus koding mu selanjutnya gmn?
maksudku koding saat njalananin itu query??
kalo nulis koding di thread lebih baik pake tag [pas] ato [code] biar gampang di analisa....

more 13 years ago
abu_nawm
saya buat pake adocommand n adotable,ini syntax di tombol simpan :
[code = pascal]
begin
perintah.commandtext := 'update produk set kode_pendaftar = "'+edit2.Text+'",jenis_produk = "'+combobox1.Text+'" where no_record = "'+edit1.text+'"';
perintah.Execute;
ADOProduk.Active := false;
ADOProduk.Active := true;
SHOWMESSAGE('Data berhasil di diedit');
end;
[/code]

more 13 years ago
heriy4nt0
@abu_nawm: mau tanya dunk,,,dah mentok nih saya punya query seperti ini 'update produk set kode_pendaftar = "'+edit2.Text+'",jenis_produk = "'+combobox1.Text+'" where no_record = "'+edit1.text+'"'; tipe field no_record = number, mungkin ga sich errornya disebabkan karena tipe field no_record nya number bukannya text ??? thanksmungkin aja, jadi --> ' where no_record = '+edit1.text; (tanpa tanda kutip) jika tipe varchar atau sejenisnya baru ada tanda "

more 13 years ago
abu_nawm
@heriy4nt0:dah dicoba bro, ga bisa jg.. pesan erronya : 'Parameter edit1.text has no default value.@abu_nawm: mau tanya dunk,,,dah mentok nih saya punya query seperti ini 'update produk set kode_pendaftar = "'+edit2.Text+'",jenis_produk = "'+combobox1.Text+'" where no_record = "'+edit1.text+'"'; tipe field no_record = number, mungkin ga sich errornya disebabkan karena tipe field no_record nya number bukannya text ??? thanksmungkin aja, jadi --> ' where no_record = '+edit1.text; (tanpa tanda kutip) jika tipe varchar atau sejenisnya baru ada tanda "

more 13 years ago
heriy4nt0
coba execute query kamu dari AdoConnection nya langsung, apakah bisa ?
(sy ndak tau salah dimana kecuali kamu tampilkan seluruh procedure nya)

more 13 years ago
abu_nawm
klo execute langsung dari adoconectionnya, g bisa kebaca dunk nilai yg dari form nya ?
klo querynya saya ubah menjadi spt ini (manual asumsi, yg akan saya update nanti no_record=20):
'update produk set kode_pendaftar = "'+edit2.Text+'",jenis_produk = "'+combobox1.Text+'" where no_record = 20';
data berhasil di update mas.
Ya masalahnya gitu... klo no_record nya diambil dari form "edit1.text",. jadinya error terus.
more 13 years ago
heriy4nt0
coba kode ini:
Delphi 7 ,sy pakai MySQL Connector 3.51 --> connetion string sesuaikan dengan yang kamu pakai,
var adocmd:TADOCommand;
sql:string;
begin
sql := <query>
adocmd:=TADOCommand.Create(nil);
adocmd.ConnectionString:='Driver={mySQL ODBC 3.51 Driver};Server=localhost;Database=test;User=root;Password=<password>;';
adocmd.CommandText:=sql;
adocmd.Execute;
adocmd.Free;
end;

more 13 years ago
setiabudi_david
coba saja syntax sqlnya diganti jadi
'update produk set kode_pendaftar = '+QuotedStr(edit2.Text)+' ,jenis_produk = '+QuotedStr(combobox1.Text)+' where no_record = '+edit1.text;
Kalo menurut saya kesalahan bukan pada syntax sql-nya. coba diteliti lagi coding keseluruhannya. atau mungkin ada property edit1 yang secara tdk sengaja terganti nilainya. coba component edit1-nya dihapus dulu lalu ditambahkan lagi.[/quote]

more 13 years ago
heriy4nt0
yap benar, kesalahan bukan pada sintax sql, tetapi bisa jadi pada component ADOcommand, atau yang lainnya - hanya karena kita tidak melihat coding keseluruhannya maka harus di test satu-persatu.
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 2 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 2 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 3 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 3 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 11 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 11 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 11 years ago
Random Topic
- Programming COMPORT dengan USB Serial Converter
by glpro in Enginering more 18 years ago - Memberisihkan checkbox di treeview yg sudah di klik
by onsir in MySQL more 16 years ago - Tanya tentang komponen Image
by bonny_rayfoxs in Multimedia & Graphic Enhancement more 11 years ago - [tanya] bagaimana load file di listbox tanpa full path name
by andrypein in Hal umum tentang Pascal Indonesia more 11 years ago - delphi free?
by daksa in Free dan Gratis more 13 years ago - Tanya Program Hotel
by xpredix in Bedah Kasus more 16 years ago - delphi RS 232, dan mikronya ko nyendat..
by w4rek in Enginering more 16 years ago - ?? Bikin Program delphi sama dgn Query analyzer SQL
by kacungdelphi24 in Tip n Trik Pemrograman more 15 years ago - coding tuk......kirim key (keyboard) ke sistem windows.....
by mas_kofa in Hal umum tentang Pascal Indonesia more 16 years ago - [ASK]tanya code print
by Iansx in Tip n Trik Pemrograman more 16 years ago