|
|
for example i have parameter name param1 for a sp and now normally we have to assign a value to this param1 like param1.value="some value" here i want to give a null value
Hope iam clear!!
Gautham
|
|
|
|
|
Use DBNull.Value in .NET to pass NULL to the database.
|
|
|
|
|
Thanks!
Gautham
|
|
|
|
|
SELECT ProductID,(@BestSpeed / (SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) * 100) As [Speed],<br />
FROM Products P
The following code retrieves an integer, Product ID, and another field, Speed. How do I know what datatype speed is and how can i change it? It returns a percentage value but currently I am getting, for example :45.5621301775148. Presumably this is a float. I would prefer say Decimal(18,2)
Thanks
|
|
|
|
|
can us Convert function
SELECT ProductID, CONVERT(decimal(18, 2), (@BestSpeed / (SELECT AVG(Finalised) FROM Leads WHERE Finalised IS NOT NULL AND ProductID = P.ProductID) * 100)) As [Speed],
FROM Products P
i've used same on strings for converting to number / date
but not for numeric
|
|
|
|
|
CONVERT(decimal(18, 2), @BestAPR / (SELECT AVG(APR) FROM Leads WHERE APR IS NOT NULL AND ProductID = P.ProductID) * 100) As [APR]
The following seems to work fine. Thanks
|
|
|
|
|
hi ,
well thats what JIT says everytime i run an sql server 05 express sample on my pc.Somehow the code that i write for the dbs i've made runs fine. But every sample ive got , including samples from MSDN give me that error.
"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)"
Could someone perhaps tell me how to enable remote connections!? I'm quite a newbie with sqlserver.
thanks
Gideon
|
|
|
|
|
giddy_guitarist wrote: well thats what JIT says everytime i run an sql server 05 express sample on my pc
If you refer to the SQL Server using some form of network naming convention it will attempt to connect with TCP/IP which is, for security, turned off by default.
e.g. The connection string says: Server=localhost it will attempt to connect via IP address 127.0.0.1 (the loopback adapter)
Try Server=(local) as that will attempt to use a (I think) shared memory connection which doesn't go through any network adapter.
|
|
|
|
|
Take a look at SQL-Server's "Surface Area Configuration" tool. By default SQL-Server 2005 doesn't allow connections from remote machines. You need to explitely change this setting.
|
|
|
|
|
He says he is running "an sql server 05 express sample on my [his] pc". Thus he does not need to open anything to the outside world as all parts are running on the one PC. The question appears to be a false lead, driven by the error message.
|
|
|
|
|
|
giddy_guitarist wrote: This is the connection string in the config file:
connectionString="Data Source=ONTEORA-PH0OA8I;Initial Catalog=Northwind;Integrated Security=True"
I added Server=localhost and Server=(local). Nothing.
Data Source and Server are synonyms. Pick either Data Source or Server and stick with it. I suspect Data Source trumps Server , and because you are referring to your PC by name it is attempting to use a network connection.
|
|
|
|
|
i got the sample working.
Could you just help me out with the following:
I now need a connection string that loads a database thats in the same directory as the .dll , .exe
When i connect to my database in the server explorer and check the property window , the connection string reads:Data Source=.\SQLEXPRESS;AttachDbFilename="E:\Gid\Hotel Management Studio\HotelManager.Core\DataServices\HTLDATA.mdf";Integrated Security=True;User Instance=True
Now , if i use this in SqlConnection() it works fine. Now if i change AttachDbFilename=HTLDATA.mdf. . .and then copy the .exe and the DB into another location . .it doesnt work saying "A dbase with the same name exists or the file cant be open" . So i cant copy my database and use it on the same pc? but then VS itself copies my database from the Project folder into the bin.
I found this site:http://www.connectionstrings.com/?carrier=sqlserver2005
The last section has .NET connection strings , i tried:
Attach a database file on connect to a local SQL Server Express instance
Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
But this doesnt work too. Whats dbname? I tried HTLDATA(.mdf)
What sring should i use?
|
|
|
|
|
Hi!
I have three Columns. Category, Type and Item. How would I write a stored Procedure to take values in those three columns and combine them into one column?
So instead of having Category = Test, Type = Test and Item = Test, you will have one column with all the values like: Test / Test / Test.
Thanks!
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
SQL Server usage
SELECT category + '/' + type + '/' + item AS colname FROM tblA
will return a "/" seperated string.
|
|
|
|
|
Hallo frends,
I want to take result from stored procedure into my Crystal report but cnt see strored procs
into my database expert of Crystal Report.
I m using vb.net & mysql 5.0 & using ODBC for connection on report which includes DSN that i made already on my machine.
But though i m check on "Show Stored procedure" under database exper->options->DataExplorer.
But not showing any stored proc yet only tables.
How should i call my stored proc in crystal RPt.
Please Tell me soon.
Thanks.
-Regards Priya.
"The Difficult i can do it now...
The Impossible will take a little longer."
|
|
|
|
|
Hi Priya,
Please tell me which version of .Net (2003 or 2005) and Crystal Report version (9 or 10) are you using??
I am currently working .Net 2005 with SQL 2000 as backend. I am not sure the same should work on MySQL.
NOTE 1 point: When adding Stored Procedure in Crystal Report, you should have only one SQL Query.
For example.
CREATE PROCEDURE Sql1
AS
BEGIN
Select * from Table1
-- Select * from Table2 (Note -- this should be commented)
END
Hope you are getting the above example. If not, please reply. I will explain in detail.
- Harini
|
|
|
|
|
Hi,
I am using the sql server for creating the database. I want to create the database which is having userid and password. This I require since I wanted to restrict acces to database and also only authorise user to database can use the userid and password created at time of creation of database.
So how can I create the database which is having userid and password?
Thanks in advance..
MikeRT
|
|
|
|
|
I think you may work with "security"
select your database and go to "security" you can there set logins.
|
|
|
|
|
CREATE TABLE [dbo].[TblLogin] (
[Name] [varchar] (50) ,
[username] [varchar] (20),
[passwd] [varchar] (20) ,
[Email] [varchar] (100)
)
GO
with Regards,
Imthiyas Ahamed.A
|
|
|
|
|
what is understand is, you are trying to create a database from your application and you want to have a valid users for it.
If so, create database, then create user and assign access permission for accessing the database.
however sa user will be able to access the new database. also any other user who have System Administrators role on other database same instance of SQL Server will be able to access the database. to my knowledge this cannot be restricted
|
|
|
|
|
Hi,
Problem is that the sql server on which i want to create the database is having some password.However as the login id to access the Master is 'sa' and which is universally fix . I can create database using master. But when I want to give userid and password to database I have created I should know the userid and password of sql server. Theirafter I can access the database and change the user of it. That's why I am tinking that if at time of creation If we assign some id and password to database it can be easy.
I think it's lot explanatory.
Mike
|
|
|
|
|
not getting exactly what you are looking for
|
|
|
|
|
I want to create database on sql server which is having it's own userid and password. The application which is going to create database on sql server do not have the user id and password of sql server. However the userid for Master database is 'sa' and password ''(blank) application can create database using master database.
Then since apllication is not aware of userid and password of sql server I am thinking that If we can give userid and password to the database at time of creation then It can be acessible to my application and also provide security as userid and password is with application only. Can it be possible?
Mike
|
|
|
|