|
Which is better?
sqlDataReader[i]
sqlDataReader["columnName"]
sqlDataReader.GetValue(i)
where i is index of column
|
|
|
|
|
i prefer using the column name, for the simple reason that it is more readable than using a column index...
moreover, it would avoid some debug mistakes...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
sqlDataReader["columnName"]
is generally used....
coz giving number as index may create prob if the sequence of columns is changed
Annpurna Tiwari
IIPL Company
Nagpur
India
|
|
|
|
|
Hi, i just wanna download DB2/ORacle editor in my system having the OS windows 2000.How can i download this freely in my machine.Plzz help me.
Thanks
BhuvanaSathish
|
|
|
|
|
oracle databases are free unless you use the DL versions for sell and some reasons explained on the website....
did you have a look at their site ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have SQL Server 2000 installed on my laptop, as well as Visual Studio .NET 2003. I am going through a tutorial in which it asks me to go to the Northwind database and right-click on Views and select New View. When I right-click on Views, the only context menu items I get are Refresh and Properties. Does anyone know why I do not get the "New View..." menu item in Server Explorer within Visual Studio .NET? Thanks in advance.
Dan
|
|
|
|
|
I'd suspect that you don't get all the options you would get in Enterprise Manager from within the IDE.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Check your are db owner on the security panel for the database. You may not have rights to create a view.
|
|
|
|
|
Upon further investigation, it turns out that Visual Studio.NET Professional visual data tools (via Server Explorer) do not work with SQL Server 2000, but only with the SQL Server Desktop Engine (MSDE). This is actually on the features page for Visual Studio, but who looks at that, right?
So, here's what I did... I left SQL Server 2000 on my laptop, and installed the MSDE (they can reside together). Some good instructions for doing this are here. After doing this, you can use the Server Explorer to create a connection to the MSDE and create tables, views, etc.
Another problem I ran into was the tutorial that I was going through had examples using the Northwind sample database, which comes with SQL Server, but not with MSDE. I used the Data Transformation Services (Import/Export Wizard) to copy the Northwind database from SQL Server 2000 to my MSDE.
|
|
|
|
|
I need to get the relationships that exist between the tables in a database. The database structure is unknown to me , i.e at runtime the program connects to any database be it Access or SqlServer. From that database i get the info. related to the tables such as the columns that exist in it, their datatypes,etc but not the table relationship to other tables. For SQL databse i have used this approach - I have used SQLDMO to get the table names. Then generating a select statement e.g: "SELECT * FROM Tablename" and then using DataAdapter.FillSchema method i get the structure of the table. But i also need the realtionships that exist between the tables. Could any one help me??! (Using C#)
|
|
|
|
|
I assume you have access to enterprise manager.
Look for any database diagrams. If there are none add the tables you need into a new database diagram and the foreign key relationships will show themselves.
|
|
|
|
|
Usually you need to access the metadata tables of the database to get this information.
There's no standardized way to get this information. For example, Access stores tables in a table MSysObjects and relationships in a table MSysRelationships, but SQLServer will have a different system.
Regards,
mav
|
|
|
|
|
You can query foreign key relationships from the INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS view. You could also get the schema from the INFORMATION_SCHEMA views. Look up INFORMATION_SCHEMA in SQL Server Books Online.
|
|
|
|
|
I have a matter with Ms.Access. I don't know how to pass the value from one form to another form. Also, I want to set this value to the text-box of the destination form.
For example:
I'd like to transfer the value '5' inside the code VBA of the form 'form1' to the form 'form2'. After moving successfully, I want to show this value in a text-box of the destination form. Please point me to a way of solutions.
Thanks so much...
|
|
|
|
|
Suppose you have two forms and they are Form1,Form2. Form2 is your destination form. Where you want to pass a value 5 to Form2's textbox. The following code should work.
Dim form2 as New Form2
form2.TextBox1.Text = "5"
Tutul
|
|
|
|
|
I have two colums, WPID and WNum. WPID is distinct, but WNum can be reapeated.
For instance, I could have WPID 1-10, and each value for WNum would be 55555. What I need to do is get the maximum value for WPID associated to WNum, in this case 10.....and spin through all the records this way.
I've tried (and other ways):
SELECT MAX(WPID) AS Expr1, [WNum]
FROM WP_General_Info
GROUP BY [WNum], WPID
...but it's not working.
|
|
|
|
|
SELECT TOP 1 WPID, WNum
FROM WP_General_Info
ORDER BY WPID DESC
|
|
|
|
|
Thanks knarf_scot! That helps!
I'm basically using this for a SQL Server Report, and am having trouble with the footer (which shows the highest/latest value for WPID). I have my grouping right and can see my latest value for WPID, but now the values in the textboxes aren't showing for the max value of the footer.
|
|
|
|
|
Your GROUP BY clause includes the column you are trying to summarize. As a result, the query will return the maximum value of WPID for each row, which is equivalent to a simple SELECT statement.
To get the maximum value of WPID for a given WNum , use:
SELECT WNum, Max(WPID) As Expr1
FROM WP_General_Info
WHERE WNum = @WNumToFind
GROUP BY WNum
To return all values from WNum with the maximum value of WPID for each, use:
SELECT WNum, Max(WPID) As Expr1
FROM WP_General_Info
GROUP BY WNum
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
The problem I'm running into now is all the field from my child table have to be in the group by clause.
I get an error saying:
"Column "" is not valid in the select list because it is not contained in the aggregate function or the Group By clause"
|
|
|
|
|
As the error message says, any column in your grouped SELECT statement must be in an agregate function (MIN , MAX , SUM , etc), or in the GROUP BY clause. Both of the examples in my previous post satisfy this condition.
If you need to return other columns from the row with the maximum WPID , you could use a sub-query:
SELECT
I.WPID,
G.WNum,
I.OtherColumn,
I.MoreInfo,
...
FROM
WP_General_Info As I INNER JOIN
(
SELECT
WNum,
Max(WPID) As MaxWPID
FROM
WP_General_Info
GROUP BY
WNum
) As G
ON I.WPID = G.MaxWPID And I.WNum = G.WNum
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Richard!
Great! That's what I needed. Thanks so much!
|
|
|
|
|
Hai,
How i can know a stored procedure is existing in the databse or not by writing code in the vb.net?Any way is there?I am sure somebody can show my way.
Thank You,
Rahul.P.Menon.
SoftwareDeveloper(.NET)
|
|
|
|
|
This query should point you in the right direction.
SELECT SPECIFIC_NAME FROM INFORMATION_SCHEMA.ROUTINES
|
|
|
|
|
This will work or something like it in SQL Server. If you wish to use this from .NET wrap this into a Stored Proc and call from ADO.NET.
#########################################
DECLARE @SPS varchar(200)
SET @SPS = 'my_stored_proc'
if exists (select * from dbo.sysobjects where id = object_id(@SPS)
and OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
SELECT 'Yes it existed '
END
ELSE
BEGIN
SELECT 'Cant find Proc
END
###########################################
|
|
|
|