Thursday, March 29, 2012
Consolidate two UPDATE statements into on
rithm:
Payments get applied to the oldest 'bucket' first; in my example, BalanceOve
r180.
Is the value in the Payments column greater than or equal to the value in Ba
lanceOver180?
If so, subtract BalanceOver180 from Payments and set BalanceOver180 to 0.
If not, subtract Payments from BalanceOver180 and set Payments to 0.
Then go on to the next oldest 'bucket' (which would be Balance151To180) and
run the same two update statements.
There are a total of 7 columns against which payments need to be applied.
Here are the two statements that execute for each column:
UPDATE AgedBalances
SET Payments = Payments - BalanceOver180, BalanceOver180 = 0
WHERE Payments >= BalanceOver180 AND Payments > 0
UPDATE AgedBalances
SET BalanceOver180 = BalanceOver180 - Payments, Payments = 0
WHERE Payments < BalanceOver180 AND Payments > 0
My question: Can these two statements be combined into one using the ABS fun
ction or the CASE construct
or something similar that I don't seem to be able to figure out?
Sample data:
BalanceOver180 Payments
Before: 200 500
After: 0 300
OR
Before: 600 500
After: 100 0
OR
Before: 400 400
After: 0 0
You get the picture.
As always, thanks in advance for all assistance.
Carl Imthurnsomething like that:
update <yor table>
set BalanceOver180 =
case
when
(Payments < BalanceOver180) then (BalanceOver180 - Payments)
when
(Payments >= BalanceOver180) then 0
end,
Payments =
case
when
(Payments < BalanceOver180) then 0
when
(Payments >= BalanceOver180) then (Payments - BalanceOver180)
end
where Payments > 0
--
Programmer
Let me know if it works for you :-))
"Carl Imthurn" wrote:
> I'm working on a stored procedure to age balances. In short, here's the al
gorithm:
> Payments get applied to the oldest 'bucket' first; in my example, BalanceO
ver180.
> Is the value in the Payments column greater than or equal to the value in
BalanceOver180?
> If so, subtract BalanceOver180 from Payments and set BalanceOver180 to 0.
> If not, subtract Payments from BalanceOver180 and set Payments to 0.
> Then go on to the next oldest 'bucket' (which would be Balance151To180) an
d run the same two update statements.
> There are a total of 7 columns against which payments need to be applied.
> Here are the two statements that execute for each column:
> UPDATE AgedBalances
> SET Payments = Payments - BalanceOver180, BalanceOver180 = 0
> WHERE Payments >= BalanceOver180 AND Payments > 0
> UPDATE AgedBalances
> SET BalanceOver180 = BalanceOver180 - Payments, Payments = 0
> WHERE Payments < BalanceOver180 AND Payments > 0
> My question: Can these two statements be combined into one using the ABS f
unction or the CASE construct
> or something similar that I don't seem to be able to figure out?
> Sample data:
> BalanceOver180 Payments
> Before: 200 500
> After: 0 300
> OR
> Before: 600 500
> After: 100 0
> OR
> Before: 400 400
> After: 0 0
> You get the picture.
> As always, thanks in advance for all assistance.
> Carl Imthurn
>|||That worked - thank you very much Sergey.
Sergey Zuyev wrote:
> something like that:
> update <yor table>
> set BalanceOver180 =
> case
> when
> (Payments < BalanceOver180) then (BalanceOver180 - Payments)
> when
> (Payments >= BalanceOver180) then 0
> end,
> Payments =
> case
> when
> (Payments < BalanceOver180) then 0
> when
> (Payments >= BalanceOver180) then (Payments - BalanceOver180)
> end
> where Payments > 0
Thursday, March 22, 2012
ConnectionString without Password
Hello!
I am working at a ASP.NET Project with has a sign-in area. All users (the aspnet_Membership and so on) are on an external SQL Server stored.
The ConnectionString in the web.config looks like this:
<add name="hspWerbung" connectionString="Persist Security Info=False;User ID=XXXXX;Password=XXXXX;Initial Catalog=HSPWERBUNG01;Data Source=SERVER_SQL_02\STOCKHOLM"
providerName="System.Data.SqlClient" /
Is there any way to create a ConnectionString without the User ID and without the password?
When i want to reach my site on the web (not with http://localhost/...) , i can't do it with "Integrated Security=True", because there will be no user, or?
hi, some where we have to store the user name and pwd. the alternative apoach is to encript them and store in the xml file using hash algorthim. when ever you are trying to connect to the DB get the string and decript it and store in the cache or session.
sqlsqlMonday, March 19, 2012
Connectiong problem Sqlserver 2005 Express
I'm working with an Sqlserver 2005 Express database on my local machine, and using vs.net 2005.I need to enable the sqlserver cache by the way:
aspnet_regsql -E -d Northwind -ed
I encountered the remote connection problem(error:40).The northwind database was restored to the sqlserver 2005 express by the db file downloaded,and I added the ASPNET user.I also enabled the TCP/IP by using SQL Server Configuration Manager.
But all the web application connected to the Northwind database is working through the connection string:
"Data Source=WKS-DEV-04\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
Any help will be much appreciated, thank you very much for reading my post
Can you telnet to the remote SQL Express service from the client? Using such command from commandline:
telnet xxx.xx.xx.xxx yyyy
Where Xs stand for ip address of the remote server, and Ys stand for TCP port of the service. You can check the TCP port of the SQL service in 'SQL Server Configuration Manager'->SQL Server 2005 Network Configuration
|||Thank you for your reply very much.I have got it done.Sunday, March 11, 2012
Connection Trusted with Windows98
we just developed a standalone application using .NET+ C# + MSDE.
So, we're working to get a setup installation in order to deploy our
application for Windows2000/NT/XP/98 Opertaing System.
At the moment we're making some test on W/98 machine but we've got some
problems:
MSDE has been installed with flag SECURITYMODE=SQL allowing connection
trusted. In fact, after installation by W/XP we're able to connect to db
with OSQL command with -E option and with our application specifying
Integrated Security=SSPI in ConnectionString.
We don't have the same behaviour on Windows98 Operating System.
In spite of the flag mentioned above in installation I can using a
connection trusted.
Any suggestion ?
Thanks in advance, Pierluigi.
hi Pierluigi,
"Pierluigi Terzoli" <pierluigi_terzoli@.hotmail.com> ha scritto nel messaggio
news:eguAq2PZEHA.2816@.TK2MSFTNGP11.phx.gbl...
> Hi everybody,
> we just developed a standalone application using .NET+ C# + MSDE.
> So, we're working to get a setup installation in order to deploy our
> application for Windows2000/NT/XP/98 Opertaing System.
> At the moment we're making some test on W/98 machine but we've got some
> problems:
> MSDE has been installed with flag SECURITYMODE=SQL allowing connection
> trusted. In fact, after installation by W/XP we're able to connect to db
> with OSQL command with -E option and with our application specifying
> Integrated Security=SSPI in ConnectionString.
> We don't have the same behaviour on Windows98 Operating System.
> In spite of the flag mentioned above in installation I can using a
> connection trusted.
> Any suggestion ?
> Thanks in advance, Pierluigi.
>
I don't know if I correctly undertand your question...
SECURITYMODE=SQL stands for supporting both trusted WinNT connections as SQL
Server authenticated connections...
trusted connections are available only when MSDE(SQL Server) is installed on
WinNT platform... Win9x boxes only allow standard SQL Server authenticated
connections
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Yes Andrea,
you understood right and you gave me the right answer.
I'm sorry, but I don't realise that trusted connection concept is valid with
WinNT only (I suppose even for WinXP, of course).
So, it means if I want to have a application .net+msde who wants to run on
all MS Operating System including W/98 I MUST use a SQL autentication.
Right ?
We've to consider this fact on the setup routine and in the Connection
String specified inside the C# application.
Thanks so much, Pierluigi.
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> ha scritto nel messaggio
news:2l59icF8qs72U1@.uni-berlin.de...
> hi Pierluigi,
> "Pierluigi Terzoli" <pierluigi_terzoli@.hotmail.com> ha scritto nel
messaggio
> news:eguAq2PZEHA.2816@.TK2MSFTNGP11.phx.gbl...
> I don't know if I correctly undertand your question...
> SECURITYMODE=SQL stands for supporting both trusted WinNT connections as
SQL
> Server authenticated connections...
> trusted connections are available only when MSDE(SQL Server) is installed
on
> WinNT platform... Win9x boxes only allow standard SQL Server authenticated
> connections
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
|||hi Pierluigi,
"Pierluigi Terzoli" <pierluigi_terzoli@.hotmail.com> ha scritto nel messaggio
news:e9XFykQZEHA.1656@.TK2MSFTNGP09.phx.gbl...
> Yes Andrea,
> you understood right and you gave me the right answer.
> I'm sorry, but I don't realise that trusted connection concept is valid
with
> WinNT only (I suppose even for WinXP, of course).
> So, it means if I want to have a application .net+msde who wants to run on
> all MS Operating System including W/98 I MUST use a SQL autentication.
yep... MSDE must be installed on WinNT platform to take advantage of trusted
connections... the clients can be installed on all OS supported by .Net
thought...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Thanks again, Andrea.
Tomorrow we'll start working to use SQL autentication by our application,
supporting in this manner even W/98 platform.
So, we'll install MSDE on our instance with our user/pwd.
We'll use the parameters above in any ConnectionString on our application.
Have a good day, bye, Pierluigi.
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> ha scritto nel messaggio
news:2l5c5dF8l8f7U1@.uni-berlin.de...
> hi Pierluigi,
> "Pierluigi Terzoli" <pierluigi_terzoli@.hotmail.com> ha scritto nel
messaggio[vbcol=seagreen]
> news:e9XFykQZEHA.1656@.TK2MSFTNGP09.phx.gbl...
> with
on
> yep... MSDE must be installed on WinNT platform to take advantage of
trusted
> connections... the clients can be installed on all OS supported by .Net
> thought...
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.8.0 - DbaMgr ver 0.54.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>
Connection to SQL server Help SOS
//////////////////////////////////////////////////////////////////////////////////////////////
Server Error in '/ASP.NetPage530' Application.
Login failed for user 'ZEUS\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'ZEUS\ASPNET'.
Source Error:
Line 88: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 89: If Not IsPostBack Then
Line 90: SqlDataAdapter1.Fill(DsCustID1, "Customers")
Line 91: DataBind()
Line 92: End If
Source File: C:\Inetpub\wwwroot\ASP.NetPage530\WebForm1.aspx.vb Line: 90
Stack Trace:
[SqlException: Login failed for user 'ZEUS\ASPNET'.]
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
ASP.NetPage530.WebForm1.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\ASP.NetPage530\WebForm1.aspx.vb:90
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
////////////////////////////////////////////////////////////////////////////////////////////////////////
No errors exist when I work with windows application both in ACCESS or SQL SERVER Databases and no errors exists when I am using access files in asp.net applicationand in both cases i use Windows NT Integrated Security .Most probably I need to configure my IIS5.0 but how I have no idea
Can anyone help?You may need to grant 'ZEUS\ASPNET' login permissions to your SQL Server. You can do this directly in SQL Server Enterprise Manager if you have it. Otherwise, you will need to use SQL language by running osql.exe from the command line.|||Yes but in command promt it asks for a password I have only one one pasword is system password which is invalid in command promt for osql.exe how i can configure it ?please help|||Type osql /? at the command line.
This gives you a list of parameters you can use to run the program.
I think you can use the-E parameter for a trusted connection.|||Thank you trying help me but I have no idea how to use –E parameters
I have tried the following command in command prompt osql/E the output was the number 1 what it means I don't know pushing the enter gives 2 and etc
what i have to do to enable trusted connections ???|||
If you are seeing this:
1
That means you are logged in succesfully.
Now you can execute any SQL statement. Each statement can consist of multiple lines. When you are finished, typeGO on a new line and hit enter. For Example (type enter at the end of each line):
1>Select name
2>From sysxlogins
3>go
This will display a list of current logins for your database.
What you need to do next is find some documentation on SQL language on how to add logins and grant them access to databases and database objects.
Have a look here for granting an NT user login permissions:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ga-gz_8dri.asp
If you like, you can go here for security in general:http://msdn.microsoft.com/library/en-us/adminsql/ad_security_05bt.asp?frame=true
I hope this helps.
Wednesday, March 7, 2012
connection to another server
I'm working with query anlyser.
Is there a way with code to transfare to another server?
Roy,
Transfer what? Can you please explain in a little more detail what you want
to accomplish?
Andrew J. Kelly SQL MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23akEH2GCGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hello there
> I'm working with query anlyser.
> Is there a way with code to transfare to another server?
>
|||Yes Andrew
It begun from another issue i've asked on DTS aboud the log file.
I dound the property you said about TABLOCK by using sp_tableoption and it
worked fine: the log file hasen't grow in a bit. Thanks
I could run the store procedure only on the destination object by connect it
by query anlyser
I'm trying to build store procedure that will do all the options. In order
to do that i must run sp_tableoption on the destination tables on the
diffrent server. and the store procedure must start from the source server
How can i do that?
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:elQeVHJCGHA.4040@.TK2MSFTNGP12.phx.gbl...
> Roy,
> Transfer what? Can you please explain in a little more detail what you
want
> to accomplish?
> --
> Andrew J. Kelly SQL MVP
>
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:%23akEH2GCGHA.1312@.TK2MSFTNGP09.phx.gbl...
>
|||It doesn't matter where you run QA from as the code itself is always run on
the server itself, not the client. So I am still confused as to what you
want to do that you can't already. Is it a permissions issue?
Andrew J. Kelly SQL MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23Y2h8LJCGHA.3936@.TK2MSFTNGP12.phx.gbl...
> Yes Andrew
> It begun from another issue i've asked on DTS aboud the log file.
> I dound the property you said about TABLOCK by using sp_tableoption and it
> worked fine: the log file hasen't grow in a bit. Thanks
> I could run the store procedure only on the destination object by connect
> it
> by query anlyser
> I'm trying to build store procedure that will do all the options. In order
> to do that i must run sp_tableoption on the destination tables on the
> diffrent server. and the store procedure must start from the source server
> How can i do that?
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:elQeVHJCGHA.4040@.TK2MSFTNGP12.phx.gbl...
> want
>
connection to another server
I'm working with query anlyser.
Is there a way with code to transfare to another server?Roy,
Transfer what? Can you please explain in a little more detail what you want
to accomplish?
Andrew J. Kelly SQL MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23akEH2GCGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hello there
> I'm working with query anlyser.
> Is there a way with code to transfare to another server?
>|||Yes Andrew
It begun from another issue i've asked on DTS aboud the log file.
I dound the property you said about TABLOCK by using sp_tableoption and it
worked fine: the log file hasen't grow in a bit. Thanks
I could run the store procedure only on the destination object by connect it
by query anlyser
I'm trying to build store procedure that will do all the options. In order
to do that i must run sp_tableoption on the destination tables on the
diffrent server. and the store procedure must start from the source server
How can i do that?
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:elQeVHJCGHA.4040@.TK2MSFTNGP12.phx.gbl...
> Roy,
> Transfer what? Can you please explain in a little more detail what you
want
> to accomplish?
> --
> Andrew J. Kelly SQL MVP
>
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:%23akEH2GCGHA.1312@.TK2MSFTNGP09.phx.gbl...
>|||It doesn't matter where you run QA from as the code itself is always run on
the server itself, not the client. So I am still confused as to what you
want to do that you can't already. Is it a permissions issue?
Andrew J. Kelly SQL MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23Y2h8LJCGHA.3936@.TK2MSFTNGP12.phx.gbl...
> Yes Andrew
> It begun from another issue i've asked on DTS aboud the log file.
> I dound the property you said about TABLOCK by using sp_tableoption and it
> worked fine: the log file hasen't grow in a bit. Thanks
> I could run the store procedure only on the destination object by connect
> it
> by query anlyser
> I'm trying to build store procedure that will do all the options. In order
> to do that i must run sp_tableoption on the destination tables on the
> diffrent server. and the store procedure must start from the source server
> How can i do that?
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:elQeVHJCGHA.4040@.TK2MSFTNGP12.phx.gbl...
> want
>
Connection timeout/ODBC failed
I am working on a VBA (MS Access) application, which connects Remote
SQL Server by ODBC Connection. When I open this application on my
workstation the error "Connection timeout' or "ODBC - failed"
will occur, But when I open it on the remote desktop it will run.
Can you suggest me what is going wrong.
Regards,
ShitalPerhaps you are blocked by port or by IP address. Typically, SQL Server
inside a network is not exposed to the outside world directly unless it
needs to be.
Can you connect to the remote SQL Server using Enterprise Manager or Query
Analyzer?
"rock" <khandar@.gmail.com> wrote in message
news:1150108297.418689.286870@.y43g2000cwc.googlegroups.com...
> Dear All,
> I am working on a VBA (MS Access) application, which connects Remote
> SQL Server by ODBC Connection. When I open this application on my
> workstation the error "Connection timeout' or "ODBC - failed"
> will occur, But when I open it on the remote desktop it will run.
> Can you suggest me what is going wrong.
> Regards,
> Shital
>
Connection TimeOut seems not working properly
Hi all,
I use SqlHelper to connect to database. I need to set a timeout to execute some sp because I don′t want to wait for this sp if it make me wait a lot. So I set the Connection TimeOut every time I execute a sp. But this seems not working properly. I set this value to 5 and I execute a sp than runs in 15 but It waits for it.
Any idea
Best regards
www.ITCubo.net
SqlCommands and SqlConnections both have timeout parameters. Maybe one of their values is interfering with what you want.
Connection timeout
I realize this could be caused by a great deal of things, but if anybody has any suggestions I would appriciate it.
Thanks much.Leave an open connection for the next time the problem occurs. When it does, run exec sp_who2 and check the BlkBy column - if there is a value there, that is the id of the process (spid) that is blocking. Often you will have multiple blocking spids, and the key to that is to find the spid that is blocking at least one other spid but is not blocked - aka the culprit.
You can run DBCC INPUTBUFFER(culprit) to see what command it is running.
Happy hunting.
Saturday, February 25, 2012
Connection strings and SQL Express 2005
Hello,
I am working on porting a Windows Forms VB.net VS 2003 app with a SQL 2000 backend - to using VS 2005 with SQL Express 2005.
I cannot seem to figure out how to set my connection string to work in the new environment. I have already recreated my database in SQL Express 2005 and ported the VS project to VS 2005.
The old string was (in my app.config file):
<add key="ConnectionString" value="workstation id=MAIN1;packet size=4096;user id=sa;data source=MAIN1;persist security info=True;initial catalog=Dbname;password=####" />
Any ideas?
Thanks,
Sam
Which error do you get ? SQL Server Express is disabled for remote connection by default, you might check the Screencast on my site to see how to enable that.HTH; jens Suessmeyer.
http://www.sqlserver2005.de
Friday, February 24, 2012
Connection String suddenly Stops working
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working ?
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaun
Strange. It looks that both strings are correct (although I would put the
network part toward the end as a personal preference).
I often refer to http://www.connectionstrings.com/ for examples and usage of
connection strings.
Keith
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.c om...
> Hi
> Odd one here, I have a local version of SQL running on my laptop for
> demos, been working fine for years yet yesterday I suddenly get an
> error "Invalid Conection Parameter" running a sproc using the
> following connection string (Its an Access 2002 App to SQL 2000)
> strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> Works fine if I use the server based SQL resource
> So I change it to be the following and it starts working ?
> strConnect = "Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> So it started not liking the 'Network=DBMSSOCN' part but both the
> datbases have TCP/IP and Named Pipes setup as network protocols and
> bot have not chnaged config for years
> I did install SP2 for XP a few weeks ago but I'm sure I have run it
> since (mind you I wish I'd never done SP2 with all the unasked for
> 'extras' MS dump on your PC but thats another thread)
> Thanks all
> shaun
|||Thanks for the link Keith
Yep it is odd as I thought both were fine as well and the one now is
not working worked fine for months!!!
Ah well the odditiess of Microsoft
Cheers
Shaun
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message news:<uQts2dgCFHA.3908@.TK2MSFTNGP12.phx.gbl>...[vbcol=seagreen]
> Strange. It looks that both strings are correct (although I would put the
> network part toward the end as a personal preference).
> I often refer to http://www.connectionstrings.com/ for examples and usage of
> connection strings.
> --
> Keith
>
> "Shaun" <shaunsizen@.msn.com> wrote in message
> news:4a2f9143.0502030133.5892ee76@.posting.google.c om...
|||Win XP SP2 also probably updated your MDAC or exposed an MDAC vunerability
that was updated recently through Windows Updates.
Nevertheless, you are using the OLEDB for ODBC, MSADSQL? Why not just use
the SQLOLEDB directly seeing as you are not using the functionality that an
ODBC DSN would give you? If I am wrong, then it is the DRIVER=SQLSERVER
that is throwing you. That's an ODBC Only OLEDB parameter.
Sincerely,
Anthony Thomas
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.c om...
Hi
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working ?
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaun
Connection String suddenly Stops working
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working '
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaunStrange. It looks that both strings are correct (although I would put the
network part toward the end as a personal preference).
I often refer to http://www.connectionstrings.com/ for examples and usage of
connection strings.
--
Keith
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.com...
> Hi
> Odd one here, I have a local version of SQL running on my laptop for
> demos, been working fine for years yet yesterday I suddenly get an
> error "Invalid Conection Parameter" running a sproc using the
> following connection string (Its an Access 2002 App to SQL 2000)
> strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> Works fine if I use the server based SQL resource
> So I change it to be the following and it starts working '
> strConnect = "Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> So it started not liking the 'Network=DBMSSOCN' part but both the
> datbases have TCP/IP and Named Pipes setup as network protocols and
> bot have not chnaged config for years
> I did install SP2 for XP a few weeks ago but I'm sure I have run it
> since (mind you I wish I'd never done SP2 with all the unasked for
> 'extras' MS dump on your PC but thats another thread)
> Thanks all
> shaun|||Thanks for the link Keith
Yep it is odd as I thought both were fine as well and the one now is
not working worked fine for months!!!
Ah well the odditiess of Microsoft
Cheers
Shaun
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message news:<uQts2dgCFHA.3908@.TK2MSFTNGP12.phx.gbl>...
> Strange. It looks that both strings are correct (although I would put the
> network part toward the end as a personal preference).
> I often refer to http://www.connectionstrings.com/ for examples and usage of
> connection strings.
> --
> Keith
>
> "Shaun" <shaunsizen@.msn.com> wrote in message
> news:4a2f9143.0502030133.5892ee76@.posting.google.com...
> > Hi
> >
> > Odd one here, I have a local version of SQL running on my laptop for
> > demos, been working fine for years yet yesterday I suddenly get an
> > error "Invalid Conection Parameter" running a sproc using the
> > following connection string (Its an Access 2002 App to SQL 2000)
> >
> > strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
> > Server;UID=abc;PWD=def"
> >
> > Works fine if I use the server based SQL resource
> >
> > So I change it to be the following and it starts working '
> >
> > strConnect = "Server=" & DB_Server & ";DRIVER=SQL
> > Server;UID=abc;PWD=def"
> >
> > So it started not liking the 'Network=DBMSSOCN' part but both the
> > datbases have TCP/IP and Named Pipes setup as network protocols and
> > bot have not chnaged config for years
> >
> > I did install SP2 for XP a few weeks ago but I'm sure I have run it
> > since (mind you I wish I'd never done SP2 with all the unasked for
> > 'extras' MS dump on your PC but thats another thread)
> >
> > Thanks all
> > shaun|||Win XP SP2 also probably updated your MDAC or exposed an MDAC vunerability
that was updated recently through Windows Updates.
Nevertheless, you are using the OLEDB for ODBC, MSADSQL? Why not just use
the SQLOLEDB directly seeing as you are not using the functionality that an
ODBC DSN would give you? If I am wrong, then it is the DRIVER=SQLSERVER
that is throwing you. That's an ODBC Only OLEDB parameter.
Sincerely,
Anthony Thomas
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.com...
Hi
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working '
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaun
Connection String suddenly Stops working
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working '
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaunStrange. It looks that both strings are correct (although I would put the
network part toward the end as a personal preference).
I often refer to http://www.connectionstrings.com/ for examples and usage of
connection strings.
Keith
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.com...
> Hi
> Odd one here, I have a local version of SQL running on my laptop for
> demos, been working fine for years yet yesterday I suddenly get an
> error "Invalid Conection Parameter" running a sproc using the
> following connection string (Its an Access 2002 App to SQL 2000)
> strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> Works fine if I use the server based SQL resource
> So I change it to be the following and it starts working '
> strConnect = "Server=" & DB_Server & ";DRIVER=SQL
> Server;UID=abc;PWD=def"
> So it started not liking the 'Network=DBMSSOCN' part but both the
> datbases have TCP/IP and Named Pipes setup as network protocols and
> bot have not chnaged config for years
> I did install SP2 for XP a few weeks ago but I'm sure I have run it
> since (mind you I wish I'd never done SP2 with all the unasked for
> 'extras' MS dump on your PC but thats another thread)
> Thanks all
> shaun|||Thanks for the link Keith
Yep it is odd as I thought both were fine as well and the one now is
not working worked fine for months!!!
Ah well the odditiess of Microsoft
Cheers
Shaun
"Keith Kratochvil" <sqlguy.back2u@.comcast.net> wrote in message news:<uQts2dgCFHA.3908@.TK2MS
FTNGP12.phx.gbl>...[vbcol=seagreen]
> Strange. It looks that both strings are correct (although I would put the
> network part toward the end as a personal preference).
> I often refer to http://www.connectionstrings.com/ for examples and usage
of
> connection strings.
> --
> Keith
>
> "Shaun" <shaunsizen@.msn.com> wrote in message
> news:4a2f9143.0502030133.5892ee76@.posting.google.com...|||Win XP SP2 also probably updated your MDAC or exposed an MDAC vunerability
that was updated recently through Windows Updates.
Nevertheless, you are using the OLEDB for ODBC, MSADSQL? Why not just use
the SQLOLEDB directly seeing as you are not using the functionality that an
ODBC DSN would give you? If I am wrong, then it is the DRIVER=SQLSERVER
that is throwing you. That's an ODBC Only OLEDB parameter.
Sincerely,
Anthony Thomas
"Shaun" <shaunsizen@.msn.com> wrote in message
news:4a2f9143.0502030133.5892ee76@.posting.google.com...
Hi
Odd one here, I have a local version of SQL running on my laptop for
demos, been working fine for years yet yesterday I suddenly get an
error "Invalid Conection Parameter" running a sproc using the
following connection string (Its an Access 2002 App to SQL 2000)
strConnect = "Network=DBMSSOCN;Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
Works fine if I use the server based SQL resource
So I change it to be the following and it starts working '
strConnect = "Server=" & DB_Server & ";DRIVER=SQL
Server;UID=abc;PWD=def"
So it started not liking the 'Network=DBMSSOCN' part but both the
datbases have TCP/IP and Named Pipes setup as network protocols and
bot have not chnaged config for years
I did install SP2 for XP a few weeks ago but I'm sure I have run it
since (mind you I wish I'd never done SP2 with all the unasked for
'extras' MS dump on your PC but thats another thread)
Thanks all
shaun
Connection String Problem
a sql server (one db). I setup the db, built and partially populated some
tables and, from an aspx page on that account, I figured out the connection
string - works pretty well (I sure miss EM!). Now, I want to create a
windows application (desktop) to manage some aspects of that database but
the server name that works from the aspx page does not work from a windows
application. The sql server "address" is something like"
xxsql01.prod.xxxx1.secureserver.net
(Not sure if that is a name limited to the account so I "x" out parts of
it?) and there is a DB name which I use as the Initial Catalog.
Has anyone dealt with this type of server before? Any hints on how to
address it externally? I tried prefixing that address with the domain name
of the ISP account but that did not help
Appreciate any suggestions.
WayneUsing Enterprise Manager, I can register SQL Server hosted at my ISP via IP
address. Just try specifying the IP for the server name.
"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:eW6auhuDFHA.2220@.TK2MSFTNGP09.phx.gbl...
> I am working on a new website where the ISP (GoDaddy) has plans that
include
> a sql server (one db). I setup the db, built and partially populated some
> tables and, from an aspx page on that account, I figured out the
connection
> string - works pretty well (I sure miss EM!). Now, I want to create a
> windows application (desktop) to manage some aspects of that database but
> the server name that works from the aspx page does not work from a windows
> application. The sql server "address" is something like"
> xxsql01.prod.xxxx1.secureserver.net
> (Not sure if that is a name limited to the account so I "x" out parts of
> it?) and there is a DB name which I use as the Initial Catalog.
>
> Has anyone dealt with this type of server before? Any hints on how to
> address it externally? I tried prefixing that address with the domain name
> of the ISP account but that did not help
>
> Appreciate any suggestions.
>
> Wayne
>|||Ask your provider if the SQL-Server is directly accessible from the internet
and not blocked by a firewall. Many (most ?) ISP are now blocking the port
1433 to *protect* the sql-servers from outside attacks.
Even if the SQL-Server is accessible from the outside (Internet), if there
is a proxy then the connection string might be different then the one used
for ASP.NET.
S. L.
"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:eW6auhuDFHA.2220@.TK2MSFTNGP09.phx.gbl...
>I am working on a new website where the ISP (GoDaddy) has plans that
>include
> a sql server (one db). I setup the db, built and partially populated some
> tables and, from an aspx page on that account, I figured out the
> connection
> string - works pretty well (I sure miss EM!). Now, I want to create a
> windows application (desktop) to manage some aspects of that database but
> the server name that works from the aspx page does not work from a windows
> application. The sql server "address" is something like"
> xxsql01.prod.xxxx1.secureserver.net
> (Not sure if that is a name limited to the account so I "x" out parts of
> it?) and there is a DB name which I use as the Initial Catalog.
>
> Has anyone dealt with this type of server before? Any hints on how to
> address it externally? I tried prefixing that address with the domain name
> of the ISP account but that did not help
>
> Appreciate any suggestions.
>
> Wayne
>|||Thanks guys. I'll pursue those suggestions.
Wayne
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:OqUzD9uDFHA.148@.TK2MSFTNGP14.phx.gbl...
> Ask your provider if the SQL-Server is directly accessible from the
internet
> and not blocked by a firewall. Many (most ?) ISP are now blocking the
port
> 1433 to *protect* the sql-servers from outside attacks.
> Even if the SQL-Server is accessible from the outside (Internet), if there
> is a proxy then the connection string might be different then the one used
> for ASP.NET.
> S. L.
> "Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
> news:eW6auhuDFHA.2220@.TK2MSFTNGP09.phx.gbl...
some
but
windows
name
>
Connection String has Semicolon (;) - how on earth can I get this working?
Ok, here's my setup. I've got a named instance in a SQL 2000 cluster. I only have dbo rights on my database, because it is a shared infrastructure. Here's my current web.config connection string (the meat, anyway):
When I'm at the office, this is my connection string, pretty normal:
connectionString="Data Source=ServerName\InstanceName;Initial Catalog=blah..."
But, when I connect through the VPN, I can't just connect through the named instance - I have a specific port. This is where things get odd.
First, if I try to connect through SQL Server Management Studio (2005), i get nothing. If I try to connect using"ServerName\InstanceName, (comma) Port Number" it connects, but not to my instance. I get a seperate set of databases that I believe are in the default instance. So, I changed the comma to a semicolon (;) - and it still connected to the same thing - connected to the database, but to the wrong set of databases. So, on a whim, I tried plunking my string, which was now"ServerName\InstanceName;(semicolon) PortNumber" into the SQL 2000 Tools and it worked in both Query Analyzer and in Enterprise Manager. So, I thought, I'll just slam this into my connection string and all will be well. No. I can't use a semicolon in my connection string, and I can't find an escape character to use. Double semicolons don't work, a comma doesn't connect me properly, double colons don't work, the JDBC brackets don't work {} - so I'm at a loss. I'm out of ideas. I've set up aliases, and those don't work earlier.
I'm using ASP.net 2 with VB & C# and Visual Studio 2005 Professional. Thanks for any help anyone can give on this!
Have you tried with a Colon instead of a semicolon?
|||I have - no dice. I've tried a colon after the servername but before the instance name (i.e.ServerName:Port\InstanceName) as well as at the end of the entire name (ServerName\InstanceName:Port).
|||Hi jdandison,
The standard format to conifgure your port number in connection string is:string connectionString = "Server=Servername\InstanceName;port=your port number;"
So, try to change your connection string to :connectionString="Data Source=ServerName\InstanceName;port=NewPortNumber;Initial Catalog=blah..."and try again.
Tell us if you have any further questions. thanks
Connection String for SQL Server not working
I have the Visual Studio 2005 Team Suite trial version and the SQL Server 2005 trial (which came with team suite) installed in my machine.
When I installed the SQL Server 2005 I installed it in the Windows Authentication mode. So every time I open SQL Server 2005 it doesnt ask for Username/Password (Its greyed out). The only thing available were:
Server Type: Database Engine
ServerName: ServerSue
Authentication: Windows Authentication.
Here is my Problem:
I created a small application in C#. In the web.config file I created the following:
<
appSettings><
addkey="resumecon"value="SERVER=ServerSue;database=Resume;"/></
appSettings>Then in the Code behind I created the following string:
string
strResCon =ConfigurationManager.AppSettings["resumecon"].ToString();Then in method (for a Login page) I created the connection string as follows and wrote code to insert some values into the Resume database. I called this method on a button click event.
SqlConnection
conLogin =newSqlConnection(strResCon);When I run the page and when I click the button I get the following error:
Login failed for user ''. The user is not associated with a trusted SQL Server connection.
I think some thing is wrong in the addkey of webconfig? How do I change this?
You have set the database for Windows Authentication but the user account accessing the database does not have permission to it. You need to know thw account used to access the database, which would be the ASP.NET Process account unless you're authenticating or impersonating. Grant that account access to the database or place it in a Windows group that has access.
Or use SQL Authentication.
Jeff
|||Thanks Jeff. I am too new to SQL Server 2005. I have been using asp.net for the last 5 months and used SQL Server 2000 before.
I didnt quite understand what you mentioned. So is it safe for me to uninstall SQL Server 2005 and install it back with server authentication with a username and password? In that way I can specify the usaname password in the string
Because in the past with SQL Server 2000, I had some virus attack in my machine.
|||You can use SQL either way, you just need to provide the correct authentication for it. Take a look atwww.connectionstrings.com for options in connecting to SQL, and the documentation for using Windows Authentication. In many cases I would recommend reconfiguring and using SQL Authentication, especially for beginners since most examples assume it, but it's really your choice.
Jeff
|||Thanks so much Jeff. I still havent got the time to do it. I am going to do this weekend and if things go wrong, (rarely I would say), I might post a question here.|||I am back again. I uninstalled SQL Server 2005 and tried to re install it. But got stuck. When I got the window which says Instance name, there were 2 radio buttons: default instance and named instance.
I clicked the default instance radio button. Is this correct?
In the next window, Service Account window again there are 2 radio buttons:
1. Use the built-in service account radio button. This has a drop down with Local System and Network Service.
2. Use a domain user account radio button which is asking for user name, password, and domain.
Which one should I choose? I chose the second one and gave a username and password. But didnt know what to give for Domain name. Also I got an alert window saying some thing about my user name password not correct or so.
Sunday, February 19, 2012
Connection string for Remote Database connectivity(SQL Server2000)
hai,
I am working on ASP.NET 2003 with SQLServer2000. My application requires to be connected to the Database which is there in my Headoffice.
My SQLServerName is "MyDBServer\TestDB"
Database Name is "WebTO", UserID="******" and Password="******"
My Remote Server IP Address is "192.168.1.2" and its Static IP is "58.93.61.235"
I have specified the Connection string for my Remote Server as
"Provider=SQLOLEDB.1;Server=58.93.61.235\TestDB;UID=******;PWD=******;Database=WebTO"
(or)
"Provider=SQLOLEDB.1;Server=58.93.61.235\TestDB,1433;UID=******;PWD=******;Database=WebTO" (1433 is the Port number of the Remote SQLServer)
but it is giving the error " SQL Server does not exist or access denied".
if i execute the same application at my Headoffice (Remote Server) by changing the Connection string as
"Provider=SQLOLEDB.1;Server=192.168.1.2\TestDB;UID=******;PWD=******;Database=WebTO"
then, it is working fine.
Can anyone tell me where i went wrong or what i have to specify in my Connection string so that i can access my Remote Database Server.
Thanks in Advance,
Srinivas.
try
server=192.168.1.2,1433 ................... hope it will work
|||
192.168.1.2,1433 is also not working.
But, i don't know how can we access the Remote Server just by giving the IP without giving it's static IP.
|||did u try with the static ip
58.93.61.235,1433
My friend it seems that u aren't aware of my previos post where i have clearly mentioned that i have already tested with Static IP, 58.93.61.235,1433 but it is giving the error "SQL Server doesn't exist or access denied".
|||Hi Srinivas,
have you enabled remote connections on your sql server? one more thing why are you specifying provider=SQLOLEDB?
do take a look at this link >>>>http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_22604523.html, under the threadhttp://forums.asp.net/t/1118398.aspx
migth be helpful to you
thanks,
satish.
|||Hi Satish,
Thanks for ur reply.
Remote Connections on my SQL Server option is already in Enabled state. ( "Allow other SQL Servers to connect remotely to this SQL Server using RPC" check box is already in Checked state.)
And Regarding Provider=SQLOLEDB, when i am using OLEDB object, i need to provide the Provider information right?
And the link which u had given is asking to get registered in that site which is not a Free site.
Thank you.
Srinivas.
|||Hi,
The IP (192.168...) works because you are in LAN. Each machine can be connected with each other and the IP of the remote machine is setting to "192.168..." (You can useipconfig -all to check it in command prompt.) You can't use Query Analyzer to connect the romote database by your static IP neither. So, just assign your machine with your static IP and have a try.
Thanks.
Connection string for 1 server and 2 databases
connection string?
server: SQLSERVER
databases:
gasstations
customers
I'm working on a VB.NET application.
Thanks
BillNo, in your query, qualify the database you are not connected to (or to be
safe, qualify databases everywhere). E.g.
SELECT col_list
FROM database1.dbo.tableA
INNER JOIN database2.dbo.tableB
..
"Bill nguyen" <billn_nospam_please@.jaco.com> wrote in message
news:ezdCZk09FHA.1032@.TK2MSFTNGP11.phx.gbl...
> Is there a way to access 2 databases simultaneously using a single
> connection string?
> server: SQLSERVER
> databases:
> gasstations
> customers
> I'm working on a VB.NET application.
> Thanks
> Bill
>
Connection string for 1 server and 2 databases
connection string?
server: SQLSERVER
databases:
gasstations
customers
I'm working on a VB.NET application.
Thanks
Bill
No, in your query, qualify the database you are not connected to (or to be
safe, qualify databases everywhere). E.g.
SELECT col_list
FROM database1.dbo.tableA
INNER JOIN database2.dbo.tableB
...
"Bill nguyen" <billn_nospam_please@.jaco.com> wrote in message
news:ezdCZk09FHA.1032@.TK2MSFTNGP11.phx.gbl...
> Is there a way to access 2 databases simultaneously using a single
> connection string?
> server: SQLSERVER
> databases:
> gasstations
> customers
> I'm working on a VB.NET application.
> Thanks
> Bill
>