Hello, I am trying to insert new data into an empty column based on the matched unique ID found. There is only one table which contain three columns.
For example, in the 1st row, there are two filled column which contain unique ID and name, this data is stored in 1st source page, the third column is still empty in the same row and the function to add data to this column is in 2nd source page. I cannot
combine the source pages as each page have many functions.
I am able to transfer the unique id to the other page but when I am trying to insert the new data based on the unique ID it gives error that says:
Query input must contain at least one table or query.
This is my code to insert new data with existing unique ID from previos source page:
should I use something like this?
select Sentence from Table1 where UniqueID like '%" + Label1.Text + "%'
This is a SELECT statement, the previous one was an INSERT statement. It's not clear what you are trying to do? Show us your table structure, some sample data and the result you expect?
By the way, The above code is vulnarable to SQL injections. always use parameterized queries:
Member
43 Points
138 Posts
Unable to insert data into another column based on the unique ID
Oct 03, 2013 07:58 AM|collo|LINK
Hello, I am trying to insert new data into an empty column based on the matched unique ID found. There is only one table which contain three columns.
For example, in the 1st row, there are two filled column which contain unique ID and name, this data is stored in 1st source page, the third column is still empty in the same row and the function to add data to this column is in 2nd source page. I cannot combine the source pages as each page have many functions.
I am able to transfer the unique id to the other page but when I am trying to insert the new data based on the unique ID it gives error that says:
This is my code to insert new data with existing unique ID from previos source page:
Any ideas, help and suggestions are greatly appreciated, thank you.
Database insert access
Participant
1740 Points
453 Posts
Re: Unable to insert data into another column based on the unique ID
Oct 03, 2013 11:11 AM|anil.india|LINK
You are missing @userID parameter
Database insert access
CodePattern.net/blog
Member
43 Points
138 Posts
Re: Unable to insert data into another column based on the unique ID
Oct 03, 2013 09:29 PM|collo|LINK
should I add something like this??
Database insert access
All-Star
25756 Points
7014 Posts
Re: Unable to insert data into another column based on the unique ID
Oct 04, 2013 07:21 AM|hans_v|LINK
Take a closer look to your insert statement. the Where Clause doesn't make any sense....
Database insert access
Member
43 Points
138 Posts
Re: Unable to insert data into another column based on the unique ID
Oct 04, 2013 10:37 PM|collo|LINK
should I use something like this?
Database insert access
All-Star
25756 Points
7014 Posts
Re: Unable to insert data into another column based on the unique ID
Oct 05, 2013 02:02 AM|hans_v|LINK
This is a SELECT statement, the previous one was an INSERT statement. It's not clear what you are trying to do? Show us your table structure, some sample data and the result you expect?
By the way, The above code is vulnarable to SQL injections. always use parameterized queries:
http://www.mikesdotnetting.com/Article/26/Parameter-Queries-in-ASP.NET-with-MS-Access
Database insert access