-
January 13th, 2010, 08:42 AM
#1
Insert Into Error
Hallo,
Please could someone look at the error in my insert into syntax. Thanks
query = "INSERT INTO gprdsql.TblPracDetailsHistorynw (Prac_No, Prac_Eid, Prac_Status, Version_Type, num_pats, system_type, practice_name, Address1, Address2, Address3, Town, County, Post_code, Country, telephone, email, fax, pay_status, pay_method, bank_name, bankaddress1, bankaddress2, bankaddress3, banktown, bankcounty, bankpostcode, bankcountry, pay_acc_num, pay_sort_code, coll_status, payee_name, sub_media, system_time) "
((Select(Prac_No, Prac_Eid, Prac_Status, Version_Type, num_pats, system_type, practice_name, Address1, Address2, Address3, Town, County, Post_code, Country, telephone, email, fax, pay_status, pay_method, bank_name, bankaddress1, bankaddress2, bankaddress3, banktown, bankcounty, bankpostcode, bankcountry, pay_acc_num, pay_sort_code, coll_status, payee_name, sub_media, system_time) from
gprdsql.TblPracDetails WHERE Prac_No='" & _
Me.TxtPracNo.Text & "' "), conn)
-
January 13th, 2010, 08:22 PM
#2
Re: Insert Into Error
We can't see your DB, so how could we help? You didn't even state the error.
Also, break that down, into sections, and try each step at a time.
-
January 14th, 2010, 08:28 AM
#3
Re: Insert Into Error
the query per se should be like the following:
Code:
query = "INSERT INTO gprdsql.TblPracDetailsHistorynw (Prac_No, Prac_Eid, Prac_Status, Version_Type, num_pats, system_type, practice_name, Address1, Address2, Address3, Town, County, Post_code, Country, telephone, email, fax, pay_status, pay_method, bank_name, bankaddress1, bankaddress2, bankaddress3, banktown, bankcounty, bankpostcode, bankcountry, pay_acc_num, pay_sort_code, coll_status, payee_name, sub_media, system_time) "
query=query & " Select Prac_No, Prac_Eid, Prac_Status, Version_Type, num_pats, system_type, practice_name, Address1, Address2, Address3, Town, County, Post_code, Country, telephone, email, fax, pay_status, pay_method, bank_name, bankaddress1, bankaddress2, bankaddress3, banktown, bankcounty, bankpostcode, bankcountry, pay_acc_num, pay_sort_code, coll_status, payee_name, sub_media, system_time from gprdsql.TblPracDetails WHERE Prac_No='" Me.TxtPracNo.Text & "' "
Moreover:
You should not add the connetcion string directly to the query string
take a look at the StringBuilder: it will let you add pieces of string a sentence at a time, instead of put everithing in a single long string, where you would not be able to read what you have done at the end...
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|