Showing posts with label state. Show all posts
Showing posts with label state. Show all posts

Monday, March 26, 2012

New SQLConnection w/ user specifics......

This actually goes back to another post...I need the user to state which specifics to use when connecting to a server. I have text boxes set up and I need to have thier input placed into the New SqlConnection statement. I have used the below which did not work...

'dim connorthwind as New SQLConnection ("Server=" & strservername & ";UID=" & strUsername & ";PWD=" & strPassword & ";database=master")

See below for my code:

<%@. Page %>
<%@. import Namespace="System.Data.SqlClient" %>
<%@. import Namespace="System.Data" %>
<script runat="server">

Sub Button_Click( s As Object, e As EventArgs )
dim conNorthwind as New SqlConnection( "Server=dbtest1;UID=cbtest;PWD=password3;database=master" )

Dim strInsert As String
Dim cmdInsert As SqlCommand

cmdInsert = New SqlCommand( "sp_password_sec", conNorthwind )
cmdInsert.CommandType = CommandType.StoredProcedure
'cmdINsert.Parameters.Add( "@.loginname", txtname.text )
cmdINsert.Parameters.Add( "@.oldpwd", Password.text )
cmdINsert.Parameters.Add( "@.newpwd", txtnew.text )
conNorthwind.Open()
cmdInsert.ExecuteNonQuery()
conNorthwind.Close()
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="Server">
<h2>Password Change
</h2>
<b>User Name</b>
<br />
<asp:TextBox id="username" Runat="Server"></asp:TextBox>
<p>
<b>Server Name</b>
<br />
<asp:TextBox id="Servername" Runat="Server"></asp:TextBox>
</p>
<p>
<b>Database </b>
<br />
<asp:TextBox id="txtdatabase" Runat="Server"></asp:TextBox>
</p>
<p>
<b>Old Pass</b>
<br />
<asp:TextBox id="Password" Runat="Server"></asp:TextBox>
</p>
<p>
<b>New Pass</b>
<br />
<asp:TextBox id="txtnew" Runat="Server"></asp:TextBox>
</p>
<p>
<asp:Button id="Button1" onclick="Button_Click" Runat="Server" Text="Lookup!"></asp:Button>
</p>
</form>
</body>
</html>

What didn't work? Did you get an error?

Also, this way of connecting is quite unusual, it is a better practice to use the same connection string for everyone for a variety of reasons (eg, to use connection pooling & to maintain the proper security)

|||

...I don't think it would be possible for everyone to use the same connection if they are resetting their own pw. If they log on using a functional acct or system acct, it will not allow them to change b/c they are not logged in using their own acct...

|||

cbaxter82:

if they are resetting their own pw

What pwd are they changing? If they change their windows pwd or their application pwd it has nothing to do with a sql connection. You should not be adding users to SQL Server, that's a major headache when users come and go and it is a major security breach, too (once a user has a SQL login, they can log in via Excel if they're smart enough! You need to control access to the databse).

Monday, March 12, 2012

new problem

I got the following error message when I do an insert trigger, can anyone
please help? Thanks.
Server: Msg 8115, Level 16, State 8, Procedure ADM_APRN_ins_upd_trg, Line
108
Arithmetic overflow error converting numeric to data type numeric.
The statement has been terminated.Pls post "ADM_APRN_ins_upd_trg" code, or continue using
imagination. Thanks.
Regards,
Alfred.
>--Original Message--
>I got the following error message when I do an insert
trigger, can anyone
>please help? Thanks.
>Server: Msg 8115, Level 16, State 8, Procedure
ADM_APRN_ins_upd_trg, Line
>108
>Arithmetic overflow error converting numeric to data type
numeric.
>The statement has been terminated.
>
>.
>|||Hello Alfred,
There is very little we can do here.
The problem as the error states on in line 108. I am going
to assume that it is some sort of maths function being
carried out. Whatever it is been converted into does not
like it.
Could you post that line and the 5 lines before and after
it.
Peter
"A man is never more truthful than when he acknowledges
himself a liar."
Mark Twain
>--Original Message--
>Pls post "ADM_APRN_ins_upd_trg" code, or continue using
>imagination. Thanks.
>Regards,
>Alfred.
>>--Original Message--
>>I got the following error message when I do an insert
>trigger, can anyone
>>please help? Thanks.
>>Server: Msg 8115, Level 16, State 8, Procedure
>ADM_APRN_ins_upd_trg, Line
>>108
>>Arithmetic overflow error converting numeric to data
type
>numeric.
>>The statement has been terminated.
>>
>>.
>.
>

Wednesday, March 7, 2012

New indexes not shipped to secondary server

I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
leaving our secondary in a Read-Only state to be used for reporting. I
have a need to get a new index on the secondary server (to decrease the
14 hour run time for a report). Our primary is in Full Recovery mode
as well.
I have created the index on my primary and expected it to be created on
the secondary when the logs were shipped this morning, only to find
that the Index was not created on the secondary.
I am not very familiar with Log Shipping and our in house expert is
unavailable.
Any thoughts on what gives?
I would even take pointers on where to start looking to find the
problem.
Meredith Ryan> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
>
You need the logs shipped AND applied for this to occur.
"mryan" <coffegrl@.gmail.com> wrote in message
news:1143761656.789619.3450@.v46g2000cwv.googlegroups.com...
> I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
> leaving our secondary in a Read-Only state to be used for reporting. I
> have a need to get a new index on the secondary server (to decrease the
> 14 hour run time for a report). Our primary is in Full Recovery mode
> as well.
> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
> I am not very familiar with Log Shipping and our in house expert is
> unavailable.
> Any thoughts on what gives?
> I would even take pointers on where to start looking to find the
> problem.
> Meredith Ryan
>|||The logs had been applied. I guess I should have been a bit more
specific.

New indexes not shipped to secondary server

I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
leaving our secondary in a Read-Only state to be used for reporting. I
have a need to get a new index on the secondary server (to decrease the
14 hour run time for a report). Our primary is in Full Recovery mode
as well.
I have created the index on my primary and expected it to be created on
the secondary when the logs were shipped this morning, only to find
that the Index was not created on the secondary.
I am not very familiar with Log Shipping and our in house expert is
unavailable.
Any thoughts on what gives?
I would even take pointers on where to start looking to find the
problem.
Meredith Ryan
> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
>
You need the logs shipped AND applied for this to occur.
"mryan" <coffegrl@.gmail.com> wrote in message
news:1143761656.789619.3450@.v46g2000cwv.googlegrou ps.com...
> I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
> leaving our secondary in a Read-Only state to be used for reporting. I
> have a need to get a new index on the secondary server (to decrease the
> 14 hour run time for a report). Our primary is in Full Recovery mode
> as well.
> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
> I am not very familiar with Log Shipping and our in house expert is
> unavailable.
> Any thoughts on what gives?
> I would even take pointers on where to start looking to find the
> problem.
> Meredith Ryan
>
|||The logs had been applied. I guess I should have been a bit more
specific.

New indexes not shipped to secondary server

I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
leaving our secondary in a Read-Only state to be used for reporting. I
have a need to get a new index on the secondary server (to decrease the
14 hour run time for a report). Our primary is in Full Recovery mode
as well.
I have created the index on my primary and expected it to be created on
the secondary when the logs were shipped this morning, only to find
that the Index was not created on the secondary.
I am not very familiar with Log Shipping and our in house expert is
unavailable.
Any thoughts on what gives?
I would even take pointers on where to start looking to find the
problem.
Meredith Ryan> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
>
You need the logs shipped AND applied for this to occur.
"mryan" <coffegrl@.gmail.com> wrote in message
news:1143761656.789619.3450@.v46g2000cwv.googlegroups.com...
> I am running SQL 2k on WinS2003 servers. We are using Log Shipping,
> leaving our secondary in a Read-Only state to be used for reporting. I
> have a need to get a new index on the secondary server (to decrease the
> 14 hour run time for a report). Our primary is in Full Recovery mode
> as well.
> I have created the index on my primary and expected it to be created on
> the secondary when the logs were shipped this morning, only to find
> that the Index was not created on the secondary.
> I am not very familiar with Log Shipping and our in house expert is
> unavailable.
> Any thoughts on what gives?
> I would even take pointers on where to start looking to find the
> problem.
> Meredith Ryan
>|||The logs had been applied. I guess I should have been a bit more
specific.