Anyone know how to get passed this prblem
Dynamic SQL generation is not supported against multiple base tables
16 2165
Im not entirely sure what you mean - you can write dynamic sql to run against multiple tables.
Are you saying that you have a tool that generates dynamic sql for you and it wont work against multiple tables ?
Graham
Waht exactly you are trying to do ?
Waht exactly you are trying to do ?
i have a win form
and 2 tables
need to get info from both tables onto the form on page load
so i used a join
created sqlDataAdapter and filled the datatable
now i want to save the data. - Try
-
sqlConnection.Open()
-
sqlManager.EndCurrentEdit()
-
Dim sqlUpdate As New SqlCommandBuilder(sqlAdapter)
-
sqlAdapter.Update(sqlDataTable)
-
sqlConnection.Close()
-
Catch ex As Exception
-
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "SQL Exception Error")
-
End Try
that gives me the error
would it work if I wrote an update command for each table rather :??
Where's the query?
This could be more of a VB question than a SQL question.
-- CK
Where's the query?
This could be more of a VB question than a SQL question.
-- CK
i was testing to get the information : - select s.employeeID , e.firstname , e.Lastname , s.wages from employee e, salary s where e.employeeid = s.employeeid
Where's the query?
This could be more of a VB question than a SQL question.
-- CK
i filled the dataTable with the sqlAdapter...and created a currency manager to navigate through the records.
Should i create an update command for each table ?
If you bind that query in a some sort of adapter or data object, the query is valid but it will be treated as a view. By default, you can not update a view.
-- CK
If you bind that query in a some sort of adapter or data object, the query is valid but it will be treated as a view. By default, you can not update a view.
-- CK
By default, a view based on one or many tables is updateable.
ive created a view now - Create view Employees
-
as
-
select s.employeeID , e.firstname , e.Lastname , s.wages from employee e, salary s where e.employeeid = s.employeeid
pretty simple now how would i use it in my code ?
Well now that you have a view. Try updating it first in query analyzer. Once you did it, try to implement the same technique in your apps.
-- CK
If you bind that query in a some sort of adapter or data object, the query is valid but it will be treated as a view. By default, you can not update a view.
-- CK
No that wont work.
Gives me an error saying cannot use it because it is a view and not a stored proc.
now ive created a sproc and the information is displayed but when i try add another record and update the datatable it gives me and error saying incorrect syntax near 'employeesStoredProc'
I thought you said "
By default, a view based on one or many tables is updateable" ?
-- CK
I thought you said "
By default, a view based on one or many tables is updateable" ?
-- CK
Thats what is says in my SQL book.
Just went to look how to insert,update.
I thought you said "
By default, a view based on one or many tables is updateable" ?
-- CK
what i can do is, create 2 select statements that can be update by themselves, but at the end of the day there is going to be like 6 tables with loads of information that has to be update etc....
Create a view with all the columns you need. Create a trigger for that view to handle the insert to all tables. Use Transaction processing so that you can rollback if one of the insert fails.
-- CK
Create a view with all the columns you need. Create a trigger for that view to handle the insert to all tables. Use Transaction processing so that you can rollback if one of the insert fails.
-- CK
i created a trigger for the update of the 2 tables in question - ALTER trigger [dbo].[InsEmployee] on [dbo].[Employee]
-
after update
-
as
-
if not exists(select s.employeeID , e.firstname , e.Lastname , s.wages from employee e, salary s where e.employeeid = s.employeeid)
-
begin
-
raiserror('the employee does not exist',16,1)
-
rollback transaction
-
End
Create a trigger on the view. Not on the table.
Create the trigger on the view. Inside that trigger, that's where you UPDATE all the tables.
-- CK
Sign in to post your reply or Sign up for a free account.
Similar topics
by: duncan.lovett |
last post by:
I am working on a graphical heading generator for a clients website as
their server does not have the GD library or similar plugins for
dynamic image generation.
I have achieved the result...
|
by: Marco Loskamp |
last post by:
Dear list,
I'm trying to dynamically generate functions; it seems that what I
really want is beyond C itself, but I'd like to be confirmed here.
In the minimal example below, I'd like to...
|
by: Venus |
last post by:
Hello,
Thanks for your reply.
I understand that a control can be created dynamically in several ways:
1) using StringBuilder
2) using Controls.Add
3) using ASP PlaceHolder
But this is just...
|
by: Venus |
last post by:
Hello,
After trying some ways to do it I wanted to use something like the code
below but for some reason
is not working (I have to generate the entire form dynamically (not only the
controls)):...
|
by: Nospam |
last post by:
Is there a tutorial on dynamic SID generation?
|
by: Ghada Al-Mashaqbeh via DotNetMonster.com |
last post by:
Hi all,
I am facing a problem in dynamic code generation at run time, the problem
occurs when the dynmaic code use global data exist within the original
application.
Lets say that my...
|
by: pittendrigh |
last post by:
There must be millions of dynamically generated
html pages out there now, built by on-the-fly php code
(and jsp, perl cgi, asp, etc).
Programatic page generation is transparently useful.
But...
|
by: fedya |
last post by:
I am trying to have the last 12 months to always be the option in the dropdown for a combo box. (Basically a combobox, with dynamic options)
I am using Access 2000.
What is the function and...
|
by: dino d. |
last post by:
Hi- I want to create a dynamic image with areas so that when the user
clicks different areas, the user jumps to those pages. The problem
is, I can't seem to figure out how to do this efficiently....
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |