08-27-2015 06:58 AM
hello every one
plz tell me how to add data in two different table in a database at same time
08-27-2015 07:04 AM
Have you tried it? I seem to remember that the SQL Server ODBC connector supports multiple queries in a single statement (separated by a semicolon ';') so you can just put two insert queries into a single request to the server.
Failing that, you could write a stored procedure which takes your data and inserts it into the two tables.
08-27-2015 07:14 AM
yes .i tried it using database connectivity tool but it show error " no of columnsare not equal to parameter".
08-27-2015 07:17 AM - edited 08-27-2015 07:18 AM
Yeah, you won't be able to do it using the insert VI from the DB toolkit - you'll need to execute a custom (parameterised?) query that does one of the options I mentioned in my first reply.
Why do they need to be inserted at the same time? Can't you insert into one table and then the other immediately afterwards?
08-27-2015 08:32 AM
i don't know how to get it done with qyeries.can you provide me example.
yeah it be written one after another.please guide.
08-27-2015 08:44 AM
If it can go in one after another, why not use the INSERT database VI multiple times - once for each table?
For the query - it's just a basic SQL query - "INSERT INTO tablename (column1, column2, column3) VALUES (value1, value2, value3);" If you want, you can create a parameterised query using ? instead of value1 etc. and then use the bind parameter to assign your values to the query parameters.
08-27-2015 08:48 AM
ACTUALLY I WANT TO USE THIS VI I N A POP UP WINDOW .what i want is ..