|
Hello Dear,
Please give me some good ADO Books name.
N.Rajakumar B.E.,
Application Developer,
www.newdreamz.tk
|
|
|
|
|
Hi ppl,
I have installed Server 2005 and when I try to run my application I get the following error mssg:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
Code:
Imports System.Data
Imports System.Data.SqlClient
Public Conn As SqlConnection = New SqlConnection
Dim da As New SqlDataAdapter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Conn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=Rsch1;" & _
"Integrated Security=SSPI"
Conn.Open() ----------> Error Mssg
What could be the problem?
Tnx
|
|
|
|
|
try adding:
Imports System.Data.Sql
“Profanity is the attempt of a lazy and feeble mind to express itself forcefully”
|
|
|
|
|
hi, i need to compare two records of a table, the one with max date and the second highest one...so here need to somehow run a loop and trap the difference of each column and insert this diference in values in a hash table..
i can't get how to do this..could any one plz help me out here
thanx
|
|
|
|
|
deep7 wrote: i can't get how to do this..could any one plz help me out here
What aspect? The getting the rows out of the database? The looping over the columns? What? Since you asked in the SQL forum, I'm gussing that it is the getting stuff out of the database aspect.
To get the two rows in one result set use this:
SELECT TOP 2 *
FROM MyTable
ORDER BY [date] DESC
To get two result sets each with one row use this:
SELECT TOP 1 *
FROM MyTable
ORDER BY [date] DESC;
SELECT TOP 1 *
FROM MyTable
WHERE [date] NOT IN(SELECT MAX([date]) FROM MyTable)
ORDER BY [date] DESC;
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi, thanks,
but i wanted to know how to compare these two record which i get...its like i have to store the diffrence suppose the 'amount' value is not same, then store this in a hash table...how to compare the two records (I have to check for all columns)
hope u understood..
thanks
|
|
|
|
|
Hi!
This query shows how to do that:
<br />
select e1.EmployeeID, e1.BirthDate, <br />
cast(e1.BirthDate-(<br />
select top 1 e2.BirthDate<br />
from HumanResources.Employee e2<br />
where e2.BirthDate<e1.BirthDate<br />
order by e2.BirthDate desc<br />
) as float)<br />
from HumanResources.Employee e1<br />
order by e1.BirthDate desc<br />
You can try it with SQL Server's AdventureWorks sample DB.
Rainer Stropek
Visit my blog at http://www.cubido.at/Blog/tabid/176/BlogID/4/Default.aspx
|
|
|
|
|
In sql server 2000, i have created tables using enterprise manager, how to convert it to sql stored procedure.
|
|
|
|
|
I think you have some things muddled some where. A table is a set of data made up of rows and columns. A stored procedure is code that you can execute to manipulate or retrieve data.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Did you mean how to get the scripts of created tables?
|
|
|
|
|
yes i wanted the sql script
|
|
|
|
|
In your
Enterprise manager - Tools Menu - Generate sql script or
right click table - All tasks - Generate sql script
|
|
|
|
|
|
im using ado in vc++ for access db
i have used this query but it shows
"data type mismatch in critria expressing"
SELECT * from FDetails where ddate = '05/29/2006'
ddate is datetime field
any one has solution for this problem
regards
Gan
|
|
|
|
|
I believe MSAccess uses pound signs to deliniate dates.
SELECT * from FDetails where ddate = #05/29/2006#
|
|
|
|
|
|
Hi there friends,
I have a pre-designed database and should work with that.
One of the columns of the table is DATETIME but just used for placing current time there.Every time I add just current time there the SQL SERVER adds date before that.
How can I just Fill current time there?
Best Regards -- Ali
|
|
|
|
|
Ignore the date portion or set it to fixed date. There is no Time data type in Sql Server.
|
|
|
|
|
Thanx buddy.
But Something surprizes me here. There are two applications in this system using this database seperatley. First One is in VB6 and uses ado.old and my application that is in C#.NET and using SqlDataAdapter,My records have Date And Time but their records Just have Time !!!
Any Ideas?
Kind Regards -- Ali
|
|
|
|
|
I would suspect that VB6 is doing a conversion locally. Sql Server does not have a Time only data type. You can always store the time in an integer field if this bothers you. Just convert it to seconds or microseconds since midnight.
|
|
|
|
|
I have a select query
select col1-tbl2,col2-tbl3,col3-tbl4 ,col4-tbl1,col5-tbl1 from tbl1where condition,
The above quey col1-tbl2,col2-tbl3,col3-tbl4 are from table1 only, but it have only id(ie) the foreign key references of tables 2,3,4
I want the column with their values to join with the tables 2,3,4.
Except USING CASE
Except USING CASE
Please Guide me
-
|
|
|
|
|
The syntax for table and column names in SQL is tablename.columnname
This can be extended to schemaname.tablename.columnname and databasename.schemaname.tablename.columnname and even servername.databasename.schemaname.tablename.columnname
Putting col1-tbl2 looks like you are tying to do a subtraction operation - which is confusing at best.
Your col1, col2, etc. are all referring to either primary keys or foreign keys in which case you should, for clarity, name them to indicate that which reduces an additional burden on those trying to help you. (I hope you don't write code like this in real life)
SELECT tbl2.col1
FROM tbl1
INNER JOIN tbl2 ON tbl1.tbl2FK = tbl2.PK
INNER JOIN tbl3 ON tbl1.tbl3FK = tbl3.PK.....
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I don't know why you need all those joins - you don't seem to be using them. I'm assuming that somewhere the data that you are using in the case sits in another table.
For example:
SELECT InterimRentReceivableUpfrontTaxModeName
FROM InventoryProfile
INNER JOIN TaxModes
ON TaxModes.ID = InventoryProfile.InterimRentReceivableUpfrontTaxModeID
You need one INNER JOIN for each ID you want to turn into a name.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Please don't delete messages - it is impolite when someone has already replied.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
hi
currently i m using following query for counting and grouping
select count(*), col1 from table group by col1 having count(*) > 1
this query returns result like
count(*)-----col1
2----val1
4----val2
now i want to find the number of rows of this returning table so that i can figure out how many col1 values have count > 1
Shajeel
|
|
|
|