Showing posts with label corresponding. Show all posts
Showing posts with label corresponding. Show all posts

Wednesday, March 21, 2012

move users

hi all
how can i move all users from one sql instanz to another ?
with all corresponding privilegs?
i have to move 10 databases from one sql server to a second and then
delete the databases on the first one.
thankx for your help
mike schwarz
www.ctek.ch
These should get you going:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scri...p?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
Andrew J. Kelly SQL MVP
"Mike Schwarz" <ctek@.ctek.ch> wrote in message
news:%23cLwTDMrEHA.2776@.TK2MSFTNGP14.phx.gbl...
> hi all
> how can i move all users from one sql instanz to another ?
> with all corresponding privilegs?
> i have to move 10 databases from one sql server to a second and then
> delete the databases on the first one.
> thankx for your help
> mike schwarz
> www.ctek.ch
>
|||thank you for the reply... seems to be a very hard task, lots of options
and possibilities. it seems that the SID is the most common problem. i
will try this with the utility you gave me the link
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

move users

hi all
how can i move all users from one sql instanz to another ?
with all corresponding privilegs?
i have to move 10 databases from one sql server to a second and then
delete the databases on the first one.
thankx for your help
mike schwarz
www.ctek.chThese should get you going:
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
http://www.support.microsoft.com/?id=307775 Disaster Recovery Articles
for SQL Server
Andrew J. Kelly SQL MVP
"Mike Schwarz" <ctek@.ctek.ch> wrote in message
news:%23cLwTDMrEHA.2776@.TK2MSFTNGP14.phx.gbl...
> hi all
> how can i move all users from one sql instanz to another ?
> with all corresponding privilegs?
> i have to move 10 databases from one sql server to a second and then
> delete the databases on the first one.
> thankx for your help
> mike schwarz
> www.ctek.ch
>sql

Friday, March 9, 2012

Move next and back through rows using datareader

I have multiple dropdownlists each one filled with values from a specific column in the table. Also I have multiple textboxes corresponding to dropdownlists. For example, when I select an item from dropdownlistA, all the textboxes are filled with the first row values that contains that selected item and gives the number of rows containing this value……. In addition, I have 2 buttons one is Move Forward Button and the other is Move Previous…I am using a Record Set and don't know how to move next and back throughout the selected rows…could you help me please? I am using a vb codebehind… Thanks

A datareader (a recordset should not be used in ASP.NET) is strictly forward only. But, even if it wasn't, the real issue here is that you need to either store the results of your query in some kind of state, between requests, or requery the database to get the previous or the next result.

Please show us a bit of your code, and we'll likely be able to devise a good method.

|||

Thanks for your response,

I have 6 dropdownlists like the following,

PrivateSub fillDropDownList3()

Dim sqlStringAsString = "select * from ItemName"

Dim cmdAsNew SqlCommand(sqlString, conn)

cmd.CommandType = CommandType.Text

Dim drAs SqlDataReader

conn.Open()

dr = cmd.ExecuteReader

While dr.Read

Me.DropDownList3.Items.Add(dr(0))

EndWhile

dr.Close()

conn.Close()

PrivateSub DropDownList3_SelectedIndexChanged(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles DropDownList3.SelectedIndexChanged

Dim countAsIntegerDim sqlStringAsString = " select * from ReceiptItems where ItemName=@.ItemName"Dim cmdAsNew SqlCommand(sqlString, conn)

cmd.CommandType = CommandType.Text

cmd.Parameters.Add("@.ItemName",Me.DropDownList3.SelectedItem.Text)

Dim drAs SqlDataReader

conn.Open()

dr = cmd.ExecuteReader

While dr.Read()

count = count + 1

Me.TextBox3.Text = dr("Name")

Me.TextBox4.Text = dr("Dept")

Me.TextBox5.Text = dr("ItemName")

Me.TextBox6.Text = dr("ItemDescription")

Me.TextBox7.Text = dr("ItemSN")

Me.TextBox8.Text = dr("Date")

EndWhile

dr.Close()

conn.Close()

Me.TextBox2.Text = count

EndSub

but in the textbox corresponding to it, it just gives the first result. What I need is to know how to move to the next record, or get back to the previous one by clicking a button...

Thanks

|||Hi diana_j86,
I've reviewed your code and it seems i can somewhat figure out what you want.However, I need to clarify frist that: You query string

select * from receiptitems whereitemname=@.ItemName


would return more than one values. If i'm wrong, please ignore my suggestion and inform me.


As Norrkoping has said, sqldatareader is strictly forward only so you can NOT use it if you want to get a previous record. I suggest you use dataset(datatable) with sqldataadapter.
You code should look like this: (Sorry, i'm not familiar with vb.net , so c# instead)

page-scope variables:

DataTable tbl = new DataTable();
int count = 0; //the count of records
int current = 0; // current record showed in your text boxes

dropdownlistbox select change event handle: 
 SqlDataAdapter adpter =new SqlDataAdapter(); adpter.SelectCommand =new SqlCommand("select * from receiptItems where itemsname=@.ItemName"); adpter.SelectCommand.Parameters.Add("@.ItemName",dropdownlist3.SelectdItem.Text); adpter.Fill(tbl); count = tbl.Rows.Count;
 current=0; // ALWAYS SHOW THE FIRST ONE AFTER SLECT CHANGED textbox2.text=tbl[0][0];
 .................
Next_Button_Clicked Event handler: (Previous_Button_Clicked Event likewise)
textbox2.text=rows[current+1][0];
textbox3.text=rows[current+1][1];
....
Hope my suggestion helps
|||

Thanks, Bo Chen – MSFT.