|
Either run a parameterised query or a stored proc, passing in the value form your combo box. Try googling either of those terms and you will find many examples.
Bob
Ashfield Consultants Ltd
Proud to be a Code Project MVP
|
|
|
|
|
If you are using ADO.Net, you can create a command object. By assigning different values to its "CommandText" property, you can conduct queries on different tables. Use ExecuteReader() method to get the result.
Please give more details on what API you are trying to use to get access to the database. That way people here can better answer your question.
|
|
|
|
|
Hello everyone,
I query the db and I get a number of rows returned.
They are displayed in a form with fields to be updated.
I know how to do the update on a one by one basis.
What I want to do is be able to update multiple rows at once.
Let say for example 5 fields per row and 10 rows.
There is something about arrays and loop thru it that I cannot get to work.
Any help would be greatly appreciated.
Thanks
Murali
|
|
|
|
|
I generally loop through a datatable and update each row individually, there are some articles around where an xml string is used to pass a collection of rows into the database for updating but I have never actually needed to use it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If the new values can be expressed by expressions, then you can use an update query to update multiple records and multiple fields.
For example,
Update MyTable Set Price=Price*1.05, ItemVolume=ItemVolume+100 Where Category='Electronics';
Hope this helps. Happy programming!
|
|
|
|
|
What language are you using for your front end? Some languages will support this.
For example, Java supports batch updates so you can loop through all the entries setting the update parameters for each in turn, then do an executeBatch to do the lot in one go. (OK, before anyone points this out, not all JDBC drivers support this.)
C# has something similar, although I've never used it myself. And if you can do it in C#, you can probably do it in VB.NET as well.
|
|
|
|
|
If using T-SQL you can use a join to populate the table with the information.
|
|
|
|
|
|
I want to run a software developed in C# using SQL Server 2005 express.I want to run this program in a different mechine which don't have Visual studio but it has SQL server express.Please help me.
|
|
|
|
|
Create one installer application. You can go for InstallShild or Setup Deployment Project directly from Visual studio. Add the .NET framework in the setup and build the application.
Install the application through your installer. You might ask for configuration data elements(such as username / pass for database) while you install.
|
|
|
|
|
Thank you Abhishek Sur.
I can understand what you are saying.But how can I include SQL srever 2005 express? It is essential to run the application.Some one says that changing the connection string configuration file I can run the application but I want to know the total process in details.
modified on Wednesday, January 6, 2010 1:14 AM
|
|
|
|
|
You are talking about 2 different things, C# is the client you have written and you need to write an installer to deploy that application to the CLIENT.
SQL Server is SERVER software and as such is designed to run on a SERVER unless you are using sql express as an embedded/single user database. A quick search[^] will give you plenty of resources to help with that
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All, I have two tables. I want to avg both number from table A and table B from the same cell.
2 3 4 3 4
Table A
1 2 5 3 1
Table B
I have two tables like above. I want to average from table one cell one and table two cell one then average both number and put into a third table or get the data and use it.
For example,
1.5 2.5 4.5 3 2.5
How do I do this in sql statement .
|
|
|
|
|
You would need a common key column as some SQL programs do not keep the order of the table.
|
|
|
|
|
djj55 wrote: You would need a common key column as some SQL programs do not keep the order of the table.
I am not sure what are you saying.but I do have a column that is comon for for both tables.
|
|
|
|
|
You may need to explain the terminology here because I have no idea what "cell one" means in your question.
If you use the term "field", "record", etc., you can make your question more understandable by others.
As for your question, you can make a query on the union of the two tables to find the averages.
|
|
|
|
|
Sory for the confusion. I should tell you that I am really very very beginer about database.
I will find out how to do union and query it.
thanks.
|
|
|
|
|
Hello, I am looking for a way to find what tables are used within a stored procedure. I have around 300 stored procedures that I would like to know what if any tables are used.
I can script the stored procedures to a file that can be investigated.
Thank you for any leads
djj
|
|
|
|
|
djj55 wrote: I have around 300 stored procedures that I would like to know what if any tables are used.
If it's Sql2005, then you could use the sp_depends [^] procedure to list all the dependencies. It's replaced in Sql2008 with something new, but it would probably still work.
Hope this helps
I are Troll
|
|
|
|
|
Thank you for the reply.
As I am currently working with 2000 sp_depends is the ticket. The problem is getting the output into a table.
Thank you again,
djj
|
|
|
|
|
You're welcome
There are no 'real' options to get the multiple result-tables into a temptable under Sql 2000 that I'm aware of. In Sql2005, you could try using a CLR sproc.
As a hack, perhaps you could execute a DOS-command from SQL? If you can execute isql.exe, then you can pipe the result of the command to a textfile. It would get real messy if you try to parse the resulting textfile using SQL, so it might be easier to execute a small console application that parses it and writes it to the database.
I are Troll
|
|
|
|
|
Thank you, I will look into the "DOS" solution tomorrow. Sometime in the next three months we are upgrading to 2008.
|
|
|
|
|
Hi frd's
I am using windows server 2003 and oracle 10g Express Edition.
Unlike SQL server oracle 10g service is not starting at system start up
Can anybody suggest me a solution for this.
Thanks & Regards,
Anil Chelasani
|
|
|
|
|
Can you check the path "ORACLE_BASE\ORACLE_HOME\database"? There could be an error-log for ORADIM there.
I are Troll
|
|
|
|
|
Hi!
I have a table that contains a Date and Minutes. I want to create a query to group the entries by Date so that instead of seeing more than one entry on a day, you will only see one entry date with the total minutes?
Can anyone shed some light on this issue?
Thank you!!
Illegal Operation
|
|
|
|