|
I do not have the skills to help you, but it might help others to do so if you edit your post to include the full error message, rather than just say that you get one. Cut and paste if you can, to avoid typos.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
what is the error message ??
|
|
|
|
|
Try printing your sql (replace Execute(@Sql) with print @SQL), then paste it into query analyser and try running it from there to get more information on the error.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi all,
I want to convert a .mdb(MS-Access database) to .mdf (SQL Server 2005 database).How can i do it.
Thanks in advance.......
|
|
|
|
|
Hi,
If you got the SQL Server manager, you can "Import" the mdb-file. Create a blank sql-database, right-click within the object explorer and select "Tasks->Import"...
Regards
Sebastian
|
|
|
|
|
hi,
suppose i have 2 tables table1,table2 i wrote the following join query
SELECT * FROM table1 AS T1
JOIN table2 AS T2 ON T1.idtable1 = T2.idtable1
WHERE T1.idtable1 > 10
My Question:
Is the WHERE condition applies in the JOINED result ? Or the where is used before JOINing?
My small attempt...
|
|
|
|
|
It does apply in the JOINED result
|
|
|
|
|
It is applied to the result of the join.
In the past I have tried to "optimize" such statements as:
SELECT * FROM table1 AS T1
JOIN table2 AS T2
ON T1.idtable1 > 10
AND T1.idtable1 = T2.idtable1
but saw no improvement.
|
|
|
|
|
I think that depends on the database you are using. MS SQL would apply the where clause before the join. And you caan check this by getting the query-plan.
Wout Louwers
|
|
|
|
|
AFAIK SQL Server applies it before or after the join depending on what it thinks would give you the quickest result.
|
|
|
|
|
hi
i want to login with a unique password and access my database in person
that no one can access my database even addmin or sa and etc
i dont want any body meet my database tables and structures
i want to have some thing like database password in MS_Access
what can i do?
thanks in advance!
|
|
|
|
|
CREATE one user and give that db permissions to that user only and remove grants for other users
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Then use MS_Access.
If not, what database do you intend to use?
|
|
|
|
|
Hi
There are a lot of free databases. I am using Firebird right now. But it does not have password protection to its database files itself. Anybody can open database file to view it. Anybody can give me a suggestion for firebird database security problem.
Is there any database that has password protected? Especially for the embedded application.
Best regards,
modified on Sunday, September 13, 2009 4:12 PM
|
|
|
|
|
What exactly do you mean by password protected?
You can download SQL Server Express for free (4Gb data file limit). It has security - i.e. you need a login to get into the database.
Anyone can pick the MDf (data) file and attach it and use the data.... unless you encrypt the data with or write your own encryption algorithm.
|
|
|
|
|
Thank you very much for reply.
I want to protect my database structure. So nobody can easily open my user database to view my table structure. Minimum there is a password protection to open the user database file.
Which database can do it? MySQL? ACCESS?
Thanks,
|
|
|
|
|
Yes all of those databases allow you to 'password' protect yuor database in some manner, but the DBA on site always knows this password.
|
|
|
|
|
Hi,
I am trying to insert a new record into my table Products. The insert is done via a windows forms application that i am developing using vb.net.
I am having problems trying to insert a new record into the Products table. The SQL code is not functioning properly. The Products table has 2 foreign keys and this is where i am having the problem i think. The table structures are as follows:
Products:
PK_ProductID, ProductName, FK_SupplierID, FK_CategoryID, QtyPerUnit
LK_Categories
PK_CategoryID, CategoryName, Description
LK_Suppliers
PK_SupplierID, SupplierName, Address, PostCode
I have created a query call ProductDetails that is used to add a new product item. The user enters the details of the new product: ProductName, SupplierName, CategoryName, QtyPerUnit and the Products table should then be updated. I have used the CategoryName and SupplierName fields instead of the FK_CategoryID and FK_SupplierID as the ID's are just auto numbers and would bear no identity to the user.
However i am having extreme difficulty in getting an INSERT statement to work.
Please can someone help me?
|
|
|
|
|
Do the category and supplier exist before you try to add the product?
What code are you using to perform the insert?
|
|
|
|
|
yes they do exist. The LK_Suppliers table and the LK_Categories table have the values stored already. Both these tables are lookup tables, where the suppliers and categories details are stored. The products table uses the ID's from the LK_Categories and the LK_Suppliers tables as each product item has a category and supplier.
Currently the INSERT Statement that i am using is as follows:
'"INSERT INTO Products (ProductName, SupplierName, CategoryName, QryPerUnity)
VALUES('" & Trim(txtProdNameIns.Text) & "', '" & Trim(SupplierNameComboBox.Text) & "' , '" & Trim
(CategoryNameComboBox.Text) & "' ,'" & Trim(txtQPUIns.Text) & "')"
However when i run this code in my application the following error comes up:
"The INSERT INTO Statement contains the following unknown field name: 'SupplierName'. Make sure you have typed the name correctly, and try the operation again."
Any advise with examples would be most appreciated.
Thanks
|
|
|
|
|
It sounds like Products does not have a column called SupplierName. I suspect it is actually SupplierID if its a FK to the Supplier table.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Yes that is true. I have created a query that displays the category name and supplier name, i did this because the FK_CategoryName and FK_SupplierName in the Products table are auto numbers and would not mean anything to the customer. I have linked the Products table, LK_Categories, LK_Suppliers with the ID's however i want to display the category names and supplier names to the user.
Then when the user wants to add a product item i want it to insert a line in the Products table, but where i am going wrong is that the FK_CategoryID and FK_SupplierID are foreign keys in the Products table are that is not referenced in my SQL INSERT statement.
I hope you understand my point.
I am desperate to get this working, please help.
|
|
|
|
|
Before you insert the product you need to translate the category and supplier to get their IDs.
|
|
|
|
|
What you have done to display the nformation is correct, but what you need to do id translate the supplier and category names back to their ID values to insert into the product table. YOU have to do the lookup and supply the correct values for the insert.
Personally I would be doing the insert in a stored procedure and would look up any FK values in the stored proc.
Hopefully this makes sense
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hi i was just wondering which is the better way to insert data into database when i got large amount of data to add in.
way 1
do
"insert into db1 () values()"
execute command
while()
or
way 2
do
string = string + "insert into db1 () values()"
while()
execute command
also if lets say way 2 somewhere in the middle of the insert command there is an error would the code before it still be added?
|
|
|
|