|
mijan wrote: how to construct a charts(dynamic charts) using sql statement?do i have to create a database as well?
SQL is a declarative language for issuing commands to relational database systems (RDBMS). Though different brands of RDBMS implement their own flavors of SQL, they typically support a standardized usage of a set of commands for retrieving and modifying data.
There are many tools available for dynamically constructing charts from data, be it retrieved from an SQL query or otherwise. For desktop use, there's always Microsoft Excel. If you're making a WinForms or Web application, there are numerous controls out there that perform charting. Google will help you find a bunch.
|
|
|
|
|
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
how to make the sql server setting allow the remote connection?
|
|
|
|
|
pliz help me with this one.im building an application for searching from my database.the searching scheme is either using a dropdown list of name or a spec inserted by user.how can i retreave the data.
|
|
|
|
|
Hi All
New to .Net even newer to SQL.
I need to count a column in a table and add up number of times a value appears.
e.g.
Cat
Cat
Cat
Dog
Dog
Cow
Cat = 3
Dog = 2
Cow = 1
I am writing in VB.Net a reporting tool to query the DB. With this query I want to list each unique value (Cat,Dog,Cow) in a ListView with the corresponding value next to it.
I hope this makes sense....
Thanks
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
You can use GROUP BY to group your result based on the animal, and use COUNT to get the number of animals of the same type, e.g.:
SELECT animal, COUNT(*)<br />
FROM animaltable<br />
GROUP BY animal
It will return something like:
Cat 1
Dog 2
Cow 3
Edbert
Sydney, Australia
"A day without sunshine is like, you know, night."
|
|
|
|
|
Try this
suppose table name is 'table' and column name is 'animal'
select animal,count(animal) from table group by animal
hope yours problem will be solved.
|
|
|
|
|
I need to run a SQL statement in a C# Windows Forms program using SQLDataFillAdapter. I am binding a SQL statement to a DataGrid. I would like to give the user the ability to click a button to kill the SQL statement if it runs to long. I can't figure out how to do it.
If I run the SQL in a separate Thread, the SQL Thread never blocks (i.e. never returns control back to the Main Thread) in order to allow a button click. So this doesn't seem to be the solution.
Has anyone accomplished what I am trying to do or have any advice?
Thanks,
Mark Mokris
|
|
|
|
|
Hi Everybody,
I have read that ADO.net uses disconnected architecture.i.e it gets disconnected from database and gets connected only while updating and retrieving data. If it is true then y do we require to close connection using cn.close.
2) and what is the difference between ASP.net with VB.net and ASP.net with c#. Why is the later one so popular.
Thanking you and waiting for some kind replies.
Bye
Amit
|
|
|
|
|
Amit R wrote: I have read that ADO.net uses disconnected architecture.i.e it gets disconnected from database and gets connected only while updating and retrieving data. If it is true then y do we require to close connection using cn.close.
You don't require to, but it is good practice in my opinion.
Amit R wrote: and what is the difference between ASP.net with VB.net and ASP.net with c#. Why is the later one so popular.
Your second question is off topic for this forum, but anyway.... ASP.NET has no differences between C# and VB.NET. It is the same framework regardless of language. You could write it in Fujitsu COBOL (as it now targets the .NET Framework) if you really wanted to. The only differences are in the languages themselves and on the whole those are relatively minor.
As to why C# appears to be more popular? I can't say I'd noticed. They seem to be fairly evenly matched to me.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
doubt no 1:it is better to close the database after u can accomplish the work,otherwise it leads to some minor errors.
doubt no 2:vb.net is only for windows applications,example to be programmed for LAN or intranet applications only,whereas asp.net is the web application used to create the best features of internet applications.
and web related tasks.
asp.net having powerful features of web services,validation controls,xml etc..
ASP.NET in C# will having better future because c# is the copy of core java,so c# coding supports platform independent.so better to practice asp.net(c#) in SDK environment rather than IDE environment.
m.s.senthil kumar
|
|
|
|
|
after installing MSDE 2000 and Microsoft SQL Web Data Administrator.
i login into Microsoft SQL Web Data Administrator using Windows Integrated option and created an account for sql login.
when i tried to login using newly created account i got the following error.
Invalid username and/or password, you are using a windows login that is not your own, or server does not exist.
what could be the problem?
my os is Windows XP SP2.
|
|
|
|
|
i have aproblem using LIKE and % with stored procedure.
row:
022533228 ahmed shabana
stored procedure:
CREATE PROCEDURE sel_cust_servtel
(
@servtel char(9)
)
AS
select *
from cust
where serv_tele LIKE @servtel
Query:
exec sel_cust_servtel '%2533228' ------> return nothing
exec sel_cust_servtel '%22533228' ------> return the row
that mean it work only for one character which is not supposed to do.
|
|
|
|
|
Because a char type will space pad the value if it is less than the number of characters specified. So your first query will actually be looking for:
'%2533228 '
The solution is to use a varchar .
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
how could i connect my apllication web site i mean with my database engine. I am using SQL Server 2005.i was using express edition and then change it to enterprise edition.it doest connect with my apllication.
|
|
|
|
|
Change the connection string so it points to the new SQL Server.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
sqlConnection1.Open();
listBox1.Items.Clear();
SqlCommand loader = new SqlCommand("SELECT name from employee;", sqlConnection1);
SqlDataReader read = loader.ExecuteReader();
while (read.Read())
{
listBox1.Items.Add(read[0].ToString().Trim());
}
sqlConnection1.Close();
OR This:
sqlConnection1.Open();
listBox1.Items.Clear();
SqlDataAdapter loader = new SqlDataAdapter("SELECT name from employee;", sqlConnection1);
DataSet dataset_for_emp_names = new DataSet();
loader.Fill(dataset_for_emp_names);
for (int i = 0; i < dataset_for_emp_names.Tables[0].Rows.Count; i++)
{
listBox1.Items.Add(dataset_for_emp_names.Tables[0].Rows[i][0].ToString());
}
I know the fastest way to get data from the SQL Server is by a Query but which one is fastest in c# for retriving data the (SQLCommand with SqlDataReader or SQLDataAdapter.Fill())
thanks;)
|
|
|
|
|
Well, it's quite obviously the 1st one.
I wonder how it didn't occurs to you that using an object which will read all employee to fill a complex data structure, then take the first element of this structure is obviously slower than just reading the 1st element, mhh?
|
|
|
|
|
cbhkenshin wrote: I know the fastest way to get data from the SQL Server is by a Query
Ummmm.... Surely that is the only way? Either that, or we have a different idea of what a query is.
cbhkenshin wrote: which one is fastest in c# for retriving data
Strictly speaking, and this is taking pedantry to the extreme, it would take the same amount of time to retrieve the data either way, because the time to retrieve the data is a function of SQL Server and not C#. However, as you are refering to the time it takes for the C# application to accept the data it is receiving then I agree Super Lloyd that it would be the first option.
cbhkenshin wrote: and more apprpriate
Now, you mentioned this in the subject, but not the body. Which is more appropriate depends on your situation. You can take advantage of data binding with the latter method. With the former method you have to do more work yourself.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
hi
i have three tables named A,B,C
having common field srno.
A b c
---- ------- ----
srno srno srno
---- ------- ------
101 101 102
102 105
103
104
105
i wrote a query like : (A.srno) - (B.srno) - (C.srno)
and my ans is :103 and 104
but in a critical situation 102 is again inserted in A.
not assign to B or C.
but didn't display in my query.
plz. help me.
|
|
|
|
|
I don't understand what you are trying to achieve. Could you explain? Also, what is your current SELECT statement?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
sorry, i couldn't explain properly.
i am trying to explain by example :
i have two tables A and B having common field SRNO.
in table A i have values 101,101,101,102,102,103.
in table B i have values 101,102.
i want to write a query from A nad B, which provide me the output : 101,101,102,103.
means :
101,101,101 in A - 101 in B = 101,101 in Output
102,102 in A - 102 in B = 102 in output
103 in A - null = 103 in output
actually i wrote like :
select srno from A where srno not in (select srno from B)
but it eliminate all the instances of srno.
the output is only :103.
but i want as defined above.
could i tried well to make you understand my problem?
thanks
-- modified at 5:21 Saturday 11th February, 2006
|
|
|
|
|
hi :
I have a table for transaction that i use for entering each action that has been done in the system as requested from the user, so basically this table will be big in rows and i have about 5 types of transactions so what should i do:
1-split the table into 5 tables each hold only one type of transaction.
2-just make it all in one table as before.
Which is better???
1:for the first option the number of rows will be divided by fifth and the insert and delete time will be faster but the select time will be slower.
2:but the second option will give fast select and slow insert or delete and also a very large number of rows.
please help and thanks for your time and cooperation.
cbhkenshin
|
|
|
|
|
cbhkenshin wrote: but the second option will give fast select and slow insert or delete and also a very large number of rows.
This isn't necessarily correct. It depends on how you are inserting the rows. For instance if they key is sequential (like an IDENTITY or a timestamp) then new rows will be appended to the the end of the table. If the key is on something more random then the rows will be potentially inserted in the middle and other rows around it will be shuffled around. But it will likely only affect one additional data page.
As for deleting, I'd guess it would still be the same speed because the row is only marked as being deleted. It isn't actually removed at the time of delete.
Have you tested your performance hypotheses? Do you know for certain that option 1 has a faster insert than option 2, and vice versa for select?
Personally (and this is without knowing the full story), I'd go for option 2 and then refactor to option 1 if it becomes a problem. Also, you didn't say which is more important, the ability to insert lots of data, or the ability to select lots of data? Which do you do more of? (That will have an influence on your final answer)
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi Frenz!
I have a table with 10 Duplicate rows in a SQL Server Database. In that table there is no unique identification column name (eg: SlNo, RowNo... like that) means all rows having a common values and that table does not have any constraints. So I want remove first 9 duplicate rows from that table. How?
Kindly give the suggestions to solve this problem. coz I am learner in making Querys in SQL Server 2000.
wish me all the best.
-- modified at 23:52 Friday 10th February, 2006
|
|
|
|
|
You could try a SELECT with a GROUP BY clause containg every column name in your table, and the output columns having an additional COUNT(*)
For example:
SELECT Column1, Column2, Column3, COUNT(*)
FROM MyTable
GROUP BY Column1, Column2, Column3
ORDER BY DESC COUNT(*)
This will float all the duplicates to the top of the result set. If you have no primary key or unique constraint on any of the columns then you have no way to reliably delete only the duplicates automatically. You will need to take note of the duplicate rows and delete them manually. (Actually, I think there might be, but if you only have 9 duplicates, it would be faster to just do it manually)
I'm curious as to why you don't have a primary key on the table? I've never come across a situation where I'd leave out a primary key.
Does there look like a good candidate for a primary key? It might be a good idea to create one.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|