I have a table in that table i'm inserting all my TableNames of that database.
Now I need to pass this table name to OLEDB source DYNAMICALLY from my main table one by one
Is this possible to to pass the table name as dynamically in OLEDB source.
I suspect you are then going to run some SQL against the stored table name?
You'll need to approach this differently and run what you are trying within a SQL task.
If not, give us some more information about exactly what you are trying to achieve.
Related
As an example:
I have two tables in firebird:
TB_CUSTOMER
IDCUSTOMER (autoincrement generator)
CUSTOMERNAME
TB_PHONE
IDPHONE
IDCUSTOMER (foreing key from TB_CUSTOMER)
PHONE
I have a registration form developed in Delphi. The table data TB_PHONE are handled using a dbgrid. I can not assign the value of the field IDCUSTOMER in TB_PHONE, because it was not generated by the Firebird generator. How can I make the relationship between the tables? I want to implement it without first saving the table data TB_CUSTOMER. I'm using datamodules with IBDAC.
Any sugest?
Before detail table can be inserted into, you should have PK-index over master-table updated and having proper master-ID in it. That means that some piece of code should insert master-record before inserting detail-record. Where this piece of code would be - is only limited by your fantasy.
Few arrangements include
insert the master-row in your application. Read the id of the row. Insert detail-row using this id.
read ID from then Generator, then insert both rows (master 1st) using the obtained ID
create a stored procedure, inserting both rows and returning ID (implementing #1 or #2 server-side)
use EXECUTE BLOCK - basically ad hoc anonymous SQL procedure. But that only is available in FB 2.x and except for not using namespace it is inferior to #3.
add BEFORE INSERT trigger onto detail table, searching for ID in master and adding one if not found. This would slow down all insert operations (even when master-ID already exists - that should be checked), would not be able to fill all other master columns but ID and is potentially dangerous due to hiding application logic problems. But still that can be implemented (though ugly and dirty method)
create master-join-detail VIEW and add INSERT trigger for it, propagating the new view-row into both master-table and details-table.
et cetera
I want to implement it without first saving the table data TB_CUSTOMER
There's your problem. You need the primary key from the master table before you can save the detail. That's just the way it works. But if what you want is to make sure that the values get saved together, you can do that as a transaction. In Firebird, you can do it like this:
Begin a transaction. Exactly how you do that depends on which DB library you're using to access your Firebird database.
Run an INSERT INTO ... RETURNING statement to insert the row into your master table and retrieve the generated value as a single operation.
Use the generated PK value to fill in the FK value on your detail table.
Insert the detail row.
Commit the transaction.
My EF schema is containing views, and it is bound with an Oracle database.
Also, I do not have any control over the schema of my Oracle database, I am allowed to perform only DML operations over the views/ tables.
I can see the data getting loaded in my MVC view. There is another view, which loads individual record, and there user can change any field, and can hit the Save to update the underlying view. I know this is not as straightforward as updating tables, and so it is giving an error of operation state. Could anyone please guide me a proper way to achieve this?
We need to change the XML of EDMX file, and should change the type of the correponding view to table, in the Conceptual model's section.
Right now I have file upload/download through Entity Framework working but I see an issue coming up. In the scenario when i want to get a list of all the files associated with a record, I don't want it to pull the Data property, just the FileId and Name, because the files can be up to 10MB each.
I have LazyLoading disabled so I'm thinking about putting the Data column into another table and only load the data when I want. That way I can just supply a link to a controller with the FileId I want to download. But maybe there is a better way? All suggestions are appreciated. Thanks!
My File entity has the following properties:
FileId
FkRecord
Name
Data
you do not need to put data column in another table - just create another entity in the designer and move you [Data] column in it. don't forget to create corresponding table mapping in designer - map you data column to the column in db table.
Also create 1 to 1 association between entities. And you could use navigational properties and do not need to alter you db table!
I found similar discussion:
Can I lazy load scalar properties with the ADO.Net Entity Framework?
I am using stored procedure to extract data from two different databases to a ASP.NET application. My stored procedure work as follows
- Check if global temporary table exist or not say ##temp_table
- if exist then drop it and if not create new temporary table say ##temp_table
- Extract data from two different databases and fill it to Temporary table
- Select data from temporary table
- Drop temporary table
Now problem is that when number of users accessing the same page with same stored procedure as above then to some users it get error that temporary table already exist.
Now please some one help me to solve such problem or suggest me some alternate because I don't want to write query in side ASP code. Some one suggest me to use views. Waiting for your suggestions.
"##" tables are accessible by all connections to the SQL instance, while "#" tables are accessible only by the connection that created them. The functionality you are describing sounds like you should be using "#" tables, not "##" tables.
You must not create table, you must declare variable for temporary table storage...with the column you expect to fill out...declare table variable like this:
declare #tmpTable table(myID int,myName varchar(50));
fill it like
insert into #tmpTable
Select * from table1
use it like
select * from #tmpTable
there are 2 databases A AND B. i want to transfer data from a table in A TO a table in B. i want to use cursor for this. the duplicate datas when transferring should go to a table called duplicat table. I want a stored procedure to do the above. first i need to connect database A with database B using db link. i want the complete stored procedure. can anyone help plzzzzzzzzzz...........
Shouldn't you look for guidance rather then complete answer here, if you want to learn....
Google for how to create db link in oracle and how to use that in queries. Once this is done you just use the remote table as a normal table.
Following links are useful
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/ds_admin002.htm
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_5005.htm