|
They have two totally different purposes.
Stored procedures/functions/packages are best used for executing a(n) operation(s) on a set (or subset) of data. A view is a presentation device best used to offer existing data in a different presentation format. Doing alot of programatic work in views typically will invalidate indexes on underlying ables and slow the view down. Views should be kept fairly simple and let the SPs do the grunt transform/operation work they were designed to be good at.
Mark Conger
Sonork:100.28396
|
|
|
|
|
Excellent answer. I have yet to find anything beyond a dscription of what they are, not how or why they are used.
|
|
|
|
|
Is there any way to reboot the sqlserver in C# program?
|
|
|
|
|
Use System.ServiceProcess.ServiceController.
<br />
ServiceController sqlServer = new ServiceController("MSSQLServer", "MYSERVER");<br />
<br />
sqlServer.Stop();<br />
Or if you want to do it through T-SQL issue the SHUTDOWN command through a SqlCommand object.
|
|
|
|
|
I program a app that use one SQLConnection, two sqlDataAdatpers, one DataSet and one DataGrid. That shows Northwind DB's Customers-Orders Master-Detail records.
It runs well with:
this.sqlDataAdapter1.Fill(dataSet11);//Master
this.sqlDataAdapter2.Fill(dataSet11);//Detail
But when I modified sqlDataAdapter1.SelectCommand.CommandText from :
SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers
TO:
SELECT TOP 6 CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers
That I just want top 6 customers data and their orders detail, not all customers.
But it fail in
this.sqlDataAdapter2.Fill(dataSet11);//
Why?
Please help.
And what should I do if I want to add a parameter and get the specified customers and their orders.
Let's roll!
|
|
|
|
|
Hi, I tried to use SQLDMO to get a list of available sqlserver's name in .Net with C#. Here is my code:
SQLDMO.ApplicationClass oSQLServerDMOApp = new SQLDMO.ApplicationClass();<br />
SQLDMO.NameList oNameList;<br />
oNameList=oSQLServerDMOApp.ListAvailableSQLServers();<br />
However, it always failed at the last code of "ListAvailableSQLServers".
Can anyone please tell me why? (I have been worked on this for weeks) Thank you very much.
|
|
|
|
|
<br />
SQLDMO.Application sqlApp = new SQLDMO.ApplicationClass(); <br />
SQLDMO.NameList sqlServers = sqlApp.ListAvailableSQLServers(); <br />
for(int i=0;i<sqlServers.Count;i++) <br />
{ <br />
object srv = sqlServers.Item(i + 1); <br />
if(srv != null) <br />
{ <br />
this.cboServers.Items.Add(srv); <br />
} <br />
} <br />
if(this.cboServers.Items.Count > 0) <br />
this.cboServers.SelectedIndex = 0; <br />
else <br />
this.cboServers.Text = "<No available SQL Servers>"; <br />
found this on the web at CSharpHelp[^]
|
|
|
|
|
Sorry, it doesn't work. Same exception thrown. Thanks anyway.
|
|
|
|
|
Well what exception is thrown? Also, are you getting this error on your development box or a client machine?
|
|
|
|
|
Hello all
I'm using ADO to connect to SQL server database. I would like to know how to pass and retrieve date values from database. if anyone knows how to do it, pls explain with a simple example. I'm using vc++.
Many thanks for your help.
Hari.
|
|
|
|
|
Passing a date value is no different from passing any other data, so I assume you are looking for the format that identifies it as a date. From the SQL Server Books Online, the proper format can take any of these forms:
ODBC Datetime Format
The ODBC API defines escape sequences to represent date and time values, which ODBC calls timestamp data. This ODBC timestamp format is also supported by the OLE DB language definition (DBGUID-SQL) supported by the Microsoft OLE DB Provider for SQL Server. Applications using the ADO, OLE DB, and ODBC-based APIs can use this ODBC timestamp format to represent dates and times.
ODBC timestamp escape sequences are of the format:
{ literal_type 'constant_value' }
literal_type
Specifies the type of the escape sequence. Timestamps have three literal_type specifiers:
d = date only.
t = time only.
ts = timestamp (time + date).
'constant_value'
Is the value of the escape sequence. constant_value must follow these formats for each literal_type.
literal_type constant_value format
d yyyy-mm-dd
t hh:mm:ss[.fff]
ts yyyy-mm-dd hh:mm:ss[.fff]
These are examples of ODBC time and date constants:
{ ts ‘1998-05-02 01:23:56.123’ }
{ d ‘1990-10-02’ }
{ t ‘13:33:41’ }
When accessing a MS Access (.mdb) database, the format is #mm-dd-yyyy#, I believe.
"Nobody is Ugly at 2AM"
|
|
|
|
|
Ladies 'n Gentlemen,
i try to change the DataSets programmatically to a Crystal Report. I set the source with the SetDataSource-method of the CrystalReportViewer.
First at all, i had made a blank report with CR 9 and implements it to my c# project.
My problem now is that the setting of the Dataset takes no effect. Only if I set the datasource in the c# report designer, i can display my chosen information from the table. But therefore I don't need to set any Dataset in my code. If I remove the Datasource in the designer and try to bind the report to a dataset, there is an error such as "no field in formula".
My Dataset is filled (i've tested it). And i don't work with crystal reports for VS .NET 2003 which came up with the VS 2003.
My steps:
1. a blank report (with CR 9) and a windows application project
2. implementing the report in the project
3. filling a dataset with a table from a MS SQL Server (for testing i#ve taken the "pubs" database)
4. load the report soure file to my ReportDocument-instance
5. set unbound fields in my report
6. SetDataSource-method to my loaded report document
7. Set ReportSource to the CrystalReportviewer in my code
That all works fine, but it seems that at runtime the report got no Datasource. Any suggestions? Would be very great.
CsharpThomas alias T. LaBenche
Tom La Benche
|
|
|
|
|
Hi,
I can tell you my steps , let's see if they work for you...
1. Create a Dataset
2. Save it as XML
3. Create the report
4. set the report source to that XML.
5. Use the report and change the datasource to my dataset in memory
that worked for me, I have seen that in some machines that have XP without Service Pack, it doesn't work right, donno why...
HTH
Braulio
|
|
|
|
|
Anyone know cause when i downloaded the free binary and installed it, it was some header files and that's it... can anyone maybe tell me what and how it is used for?
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Sounds like you downloaded a MySQL library for some language/platform, rather than the MySQL application itself. Where did you download the "free binary"? The official MySQL download page is at: http://www.mysql.com/downloads/mysql-4.0.html[^]
MySQL is an Open Source database server that aims for speed and ease-of-use.
- Mike
|
|
|
|
|
That's were I downloaded from, the exact one. Scroll down to the 'Windows Downloads' section and I downloaded the first one that says
"Windows 95/98/NT/2000/XP/2003 4.0.14b 21.7M"
Help...
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Nvm Thankyou and I had it all the time but it was buried in some folders.
Amazing what *.* will do in search. LOL ;P
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
MindNets
“MindNets” is an organization that is being established for providing support and solution in different fields of IT/Computer Science.
Our Expertise includes:
Web Design and Development, Databases, Networks, Desktop Applications, Business Applications, Image Processing, Biometrics, Science and Engineering.
For Students:
During our final projects, we found that there is very little guidance for students; in working on their projects (software) using latest tools and technologies. This is where the whole idea came to our mind and became the basis of “MindNets”.
For Companies:
In this era, for each and every organization; it’s necessary to transfer its business online. This is so, because it not only helps in expanding the business but also in providing more facilities to the customers.
For this we are providing complete web site design, development and hosting facilities. We are also looking forward to facilitate these companies in building and maintaining efficient LAN/WAN networks.
So feel free to contact us at any time; you need us; as we are to help YOU.
Team:
Khurram Ishtiaq Qazi (Netsol)
(c++, visual c++, java, Oracle 8i, (sql/plsql, Developer6))
Asim Nazir (XavorInt)
(c++, java, visual c#, ASP.NET, Sqlserver 2000, Crystal Reports)
Irfan Yousaf (ICBCS)
(VB6, ASP, VB.NET, ASP.NET, Oracle, Visual C++, Visual Prolog)
Mohsin Ali (TWE)
(Microsoft Certified Solution Developer (MCSD), VB6, Flash)
Aamir Alla-u-Din (Operation Al-Badar)
(Microsoft Certified System Engineer (MCSE NT+2000), CCNA)
Contact:
Mail: mind_nets@yahoo.com
Voice: 0333-4294413
MindNets
|
|
|
|
|
Please help. When I use @From it fails with the following error , but at the same time when I spesify date is runs fine.
"The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value."
Declare @From as varchar(10)
Set @From =(case When DatePart (dw , getdate())=2 Then convert(varchar(10),(getDate()-3),101)
When DatePart (dw , getdate())=4 Then convert(varchar(10),(getDate()-2),101)
When DatePart (dw , getdate())=6 Then convert(varchar(10),(getDate()-2),101)
Else convert(varchar(10),(getdate()),101) End )
select @From
select dateentered
from NormalizedData_Out n join MaxDate_Out m
on n.StudentID= m.StudentID and (isnull(n.DateEntered, '1/1/1900') =isnull(m.maxdate, '1/1/1900'))
and n.dateentered between @From and getdate()
--and n.dateentered between '08/27/2003' and getdate()
|
|
|
|
|
Either declare @From as datatype smalldatetime, not varchar or use Convert(smalldatetime,@From,101) in the where clause.
onwards and upwards...
|
|
|
|
|
I try to run a sql file in my program. But I got an OleDbException of "TimeOut Expired". When I try the sql file in Query Analyzer, it's running very well.
Can anyone please tell me why???? waiting online.
Thanks in advance!
|
|
|
|
|
The OleDbCommand object has a CommandTimeout property, which defaults to 30 seconds. If your query takes longer than this to execute, it will abort.
Either try to improve the performance of the query, or increase the CommandTimeout .
Query Analyzer just keeps running until the query completes or you choose to abort it.
|
|
|
|
|
I am using VB.Net to build a windows form with a datagrid. is there a way to calculate a value in on column based off a value in another column?
|
|
|
|
|
The DataColumn object can be used to create an expression column:
productsTable.Columns.Add("SubTotal", Type.GetType("System.Single"), "Sum(Price)")
Hope this helps.
Andy
|
|
|
|
|
Hi, I run a sql file using ADO.Net and count the run time. But strangely, for the exactly same environment, same sql, but the run time are different. sometimes it has more than 30 seconds' differece. For example, first time it took 2 mins and 31 secondes, the next time it took only 1 minute and 54 seconds. Can anyone please tell me why and how to avoid this happens?
Thanks in advance.
|
|
|
|
|