Problem With Adding Record Into Database

Feb 3, 2004

When I try to build my solution, it tells me that "SQLCommand" is not defined.





What's the problem?





Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


'If Page.IsValid Then


Try


Dim MySQL = "addCustomerSQL"


Dim cmd As New SQLCommand("addCustomerSQL", dbConn)


cmd.Commandtype() = CommandType.StoredProcedure


cmd.Parameters().Item("@username").Value = userText.Text


cmd.Parameters.Item("@password").Value = passText.Text


dbConn.Open()


cmd.ExecuteNonQuery()


dbConn.Close()








Catch ex As Exception





End Try


End Sub

View 5 Replies


ADVERTISEMENT

Adding Image Or Picture To A Database Record

Jun 17, 2007

Hi,

I am new to SQL Server and I have got this problem and I am wondering if anyone could provide me with a solution, please.

I created a Product database table using Visual Basic 2005 Express and SQL Server 2005 Express. I have just added a new column [Picture] with IMAGE datatype to the database table, which of course, should store an image or picture of a product. I am writing to kindly ask you guys for help.

i) How do I store a picture or image for each record of this column [Picture] of database table? I have tried and all that I can see is < binary data > in the picture column, and when I start the VB 2005 Express form is a blank picture box!

ii) How do I get this image to display on Visual Basic 2005 Express form, so that when a product is selected the product image is displayed too? All text data appears but not the picture!

Your help much appreciated. Thanks.

Paul

View 3 Replies View Related

Adding A Value &#043; 1 To A Record

Nov 29, 2007

Hello

I wish to add some records to my database but I am having problems asking the SQL commands to add 1 to the previous number.

I'll explain what I mean....!

The database automatically increases the communication_number once each time a record is added. However I'd like to amend the command below to say "add 1 to the current communcation_number" rather than input a number manually as I have done below:-

insert into "communications"
(address_number, contact_number, device, ex_directory, dialling_code, std_code, number, extension, notes, amended_by, amended_on, cli_number, communication_number)
values (105, NULL, 'WW', 'N', NULL, 'WW', 'W', NULL, 'www.abc.co.uk', 'Jon', 2007-11-29, NULL, '30001');

Any help would be much appreciated.

Thanks,

Jon

View 10 Replies View Related

Retrieve Id After Adding A New Record

May 13, 2005

How do I retrieve the id of the record after I INSERT it?

View 4 Replies View Related

T-SQL (SS2K8) :: Creating Database Where Each Record Is Required To Have Twin Record In Database

May 12, 2014

,I am creating a database where each record is required to have a twin record in the database.These is a type a value and a type b value and both must be present for the record to be valid.

Customer_ID, Order_Type, Product_Code
54, a, 00345
54, b, 00356

Is this something that would have to be done programmatically, or is it possible to create a constraint of some sort to ensure this?

View 8 Replies View Related

Adding Record To Multiple Categories

Jun 16, 2006

I am pretty new to the DB part of this but have built an asp.net web appplication with 2 tables:
FORMS and UNITS
I have created a web page that will allow users to add forms and associate a unit with that form. I now need to be able to allow users to associate the form with multiple units.
I can change the web page list box to allow multiple selections but that doesn't solve the problem. This seems like a pretty simple task but I can't seem to find anything on it.
any help???
below is the stored procedure I was using:
CREATE PROCEDURE dbo.USP_AddForm

@UNIT_IDint,
@F_TYPE varchar(20),
@Titlevarchar(100),
@Keywords ntext = NULL,
@Descriptionntext = NULL,
@FileNamevarchar(50)


AS
BEGIN

SET NOCOUNT ON
DECLARE @NewFOrmID INT
INSERT FORMS

(
UNIT_ID,
F_TYPE,
Title,
Keywords,
Description,
FileName,
RevDate
)

VALUES
(
@UNIT_ID,
@F_TYPE,
@Title,
@Keywords,
@Description,
@FileName, GetDate()
)

SELECT @newFormID = @@IDENTITY
SELECT newFormID = @newFormID
END


GO

View 1 Replies View Related

Adding B Record To Output File

Apr 9, 2014

I'm not sure if I can explain this properly, but I'll try. I need to create an output file with a detailed record. I've been able to create a query that will give me the format and fields of what I need. However, the file layout calls for an additional "B" record if certain criteria is met in the detail immediately following the detail record. For example, if the PaymentMethodID = 10, then I need to add a "B" record that displays the PayeeName. I'm not sure if this would be a separate Select or a Union or maybe an Insert? All of our current layout are just Detail records and a Control Record.

Here is my current Select for the Detail:

SELECT DISTINCT
CONVERT(CHAR(10), ba.AccountNumber)
+ (REPLICATE('0', 10 - LEN(p.CheckNumber)) + CONVERT(VARCHAR(10), p.CheckNumber)) + REPLACE(CONVERT(VARCHAR(6), p.CheckDate, 1), '/', '')

[Code] ....

What I would need to add a separate B record?

View 1 Replies View Related

Difficulty Adding A Record In SSMSE

Aug 21, 2006

I'm new to SQL Server and I'm using 2005 Express with SSMSE, and having trouble adding a record to a table "manually" by typing in the data.

I find I can change most of the fields by viewing the table in SSMSE and just clicking on the field and editing it then clicking "execute SQL" but for some reason the changes don't "take" when a date field is involved.

Is there a special or proper way to enter a date that I'm not aware of? I'm not having much success figuring out this online help stuff from within SSMSE, I keep getting to help on the help system itself (oops).

TIA!

View 3 Replies View Related

Need Help With Adding A Duplicate Record Count Column To Query

Jul 23, 2005

I am attempting to create a simple recordset that would return thenumber of duplicates that exist in a table with a single column. Forexample if I had a table like the following:ID Reference Amount1 123456 1.002 123456 2.003 123 1.00I would like to get the following result:ID Reference Amount RecCount1 123456 1.00 22 123456 2.00 23 123 1.00 1Please help!Thanks,Shawn

View 2 Replies View Related

Integration Services :: Adding Trailer Record To End Of A File?

Apr 27, 2011

I have an SSIS package which takes a SQL Query and generates a PIPE (|) delimited flat file. Simple enough. However, I also need to add a Trailer record at the bottom of the file (footer). To make this happen I could either do a UNION ALL on the same query script or what I've done is to create another query with the Trailer record and using the Merge component simply merged and appended the trailer record at the botton of the actual file.

The issue, however, is that the trailer record is always including extra PIPES at the end of the trailer. According to business, this wouldn't load properly at our vendor side due to the extra pipes in the trailer record as it'll be seen as additional columns.

Is there anyway to get rid of those extra pipes at the end of the trailer?

Trailer record should look like this:

TRAILER|A|B|C|D|

As of now, the appended Trailer record looks like this (additional pipes for each column in the main query script):

TRAILER|A|B|C|D|||||||||||||||||

View 4 Replies View Related

Adding A Header Record To A Fixed Width Flat File Data Export.

Jun 21, 2007

Hi-I have a sql database (2005) that I need to extract a report from that looks somehintg like  SELECT * From Empl_Hours WHERE some_flag <> 'true' .The thing works fine, but the problem is this: I need to insert a record in the 1st row that looks like "Static_text"+row_count() +"more_static_text"where row_count is the actual # of rows that were retrieved. Thanks in advance for any help.DAn 

View 3 Replies View Related

PC SQL Server Table (with A Column Classified Unique) Synchronizes (using Merge) With 2 PPCs SQL Mobile Adding The Same Record

Aug 29, 2006

Hi, I have a doubt about the behaviour of SQL Server 2005 in the situation I'm going to describe you.
Suppose that you have a SQL Server 2005 database on your PC, and suppose that this database has a table with a column classified as "unique" (so it's impossible for this table to contain 2 records having the same value in this column).
Suppose that you publish this database and you create 2 SQL Server Mobile 2005 subscriptions on 2 Pocket PCs.
Suppose now that the first PPC (using an embedded program) creates a record with a certain value for the column (and adds it to the table), and the second PPC makes the same thing (it inserts a record with the same column value of the first PPC).
At this point, you connect the 2 PPCs to your PC (one by one, of course), to synchronize (using merge replication) the databases...

WHAT HAPPENS??? Does an error raise?
Must you give a publication setting in which you say that, if this situation occurs, PC SQL Server holds the last (or the first, as you decide) record acquired? Is it possible?

Thank you very much

View 1 Replies View Related

Automatically Adding Records To Child Table When Record Added To Parent Table

Aug 19, 2006

In SQL Server 2000, I have a parent table with a cascade update to a child table. I want to add a record to the child table whenever I add a table to the parent table. Thanks

View 1 Replies View Related

Adding A New Record Takes Longer And Longer -- Archive? (was Table Help)

Mar 1, 2005

Hi we have a table with about 400000 records in it. It starting to take longer and longer to add a new record. I was thinking of creating another identical table and archiving off most of the records every month (we are now adding about about 4000 records a day) . Is this the best thing to do?
I don't know a lot about sql server so any help or suggestions would be great

View 4 Replies View Related

Adding Data To Database Or Viewing Database In MsSQL

Jun 14, 1999

I am new to ms SQL. I only have the use of the Enterprise Manager.
Creating tables I understand. However I am confused on how to add data to
a table or view the data in a table. Can this be done through Enterprise Manager? If I am adding a large amount of data do I have to use the query window. This seems like a tedious method. In Access yo have a form basically pop up where you can type in the record sets. Any advice would be appreciated! Sincerely,
Bill Bequette

View 1 Replies View Related

How Can I Set A Update Trigger On A Table In Database A After A Record Had Been Updated From Another Database B?

Jan 22, 2008



Hi guys, may I know is it possible to create an update trigger like this ? Assuming there are two database, database A and database B and both are having same tables called 'Payments' table. I would like to update the Payments records on database A automatically after Payments records on database B had been updated. I can't use replication because both tables might having different records and some records are the same. Hope can get any assistance here, thank you.

Best Regards,
Hans

View 8 Replies View Related

Inserting Record Into Second Database From A Stored Procedure In First Database

Aug 10, 2005

is it possible to insert record into second database from a stored procedure which is in first database?

View 1 Replies View Related

Adding An Int To A SQL Database Using C#

Feb 17, 2008

Hi Guys,
I know this is a little off the subject of ASP.net but I am using some code behind in C#.  I am a real novice at this and so it may appear to be a simple question but Im trying to add a number to the database from a textbox but it is having issues as the Storenum is an int and it wants a string.  Can anyone help?  I know I need to write .tostring somewhere but can't work out where.  My code is below.
Thanks in advance. =)
public partial class _addstore : System.Web.UI.Page
{protected string Location;
protected string Telephone;protected string Prefix;
protected int StoreNum;protected string myConnectionString;protected void Page_Load(object sender, EventArgs e)
{
Location = "default";Telephone = "default";
Prefix = "default";StoreNum = "0";myConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\HOF\App_Data\HOF.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;";
 
}protected void Button1_Click(object sender, EventArgs e)
{int sa;
SqlConnection myConnection = new SqlConnection(myConnectionString);
try
{
Location = TextBox2.Text;
Telephone = TextBox3.Text;
Prefix = TextBox4.Text;
StoreNum = TextBox5.Text;SqlCommand myCommand = new SqlCommand("INSERT INTO StoreInfo (StoreID, Location, Telephone, Prefix) Values (" + StoreNum + ", '" + Location + "', '" + Telephone + "', '" + Prefix + "')", myConnection);SqlDataAdapter myDataAdapter = new SqlDataAdapter(myCommand);
myConnection.Open();
sa = myCommand.ExecuteNonQuery();
myConnection.Close();
}catch (Exception ex)
{
TextBox2.Text = ex.Message;
myConnection.Close();
}
}
}

View 3 Replies View Related

Adding A New Database

Mar 13, 2005

Hi, I am so very new at using asp and my problem is that i have created a new access database and I am unable to connect to it. I am using the desktop engine and I can connect to all the sample database's fine. I've tried using the osql statments at the command prompt and after I am granted login and try to grant access to my new database called 'Assets' it tells me that i do not have access or permission to this database. If anyone can help me I would so so appreciate it (I need idiot instructions :) ).

View 2 Replies View Related

Adding Values In Database

Apr 15, 2008

Hi guys, I need some help again please.
On my page load, I need the following done...
I have a label control that must display a certain numeric value. This value must be the sum of an array of values that must be retreived from a table ("Details") with the column name "DealValue" but only where the column "ConsultantID" = txtConsultant.text
I understand the select statement, but I don't know how to "run" through the table to add all the values. Can someone please help me with this and how I would construct the MSSql select statement for this.
Thanks again

View 4 Replies View Related

Adding A New Database File???

May 27, 2008

HI, I was going across the SQL tutorials, sql tutorial # 2 am coming across a preliminary problem.
When I click the 'add new item' tab from the website menu, and choose 'SQL Database', the connection is not setup and the error reads as follows:
Connections to SQL server files require SQL server 2005 to function properly.Please Verify the installation of the component or download the URL:.....
 
Now I have the necessary data connections working in my database, but I just can't figure out why is this going wrong.If somebody can literally spoonfeed me here, I'll be grateful, I am a pure newbie here, thanks!!!

View 3 Replies View Related

Adding A New Database Error

Jun 19, 2008

Hi guys, I am facing a confusing problem, whenever i select the add new item tab and choose add sql database, it reads an error stating 'Connections to sql server files require SQL server 2005 to be functioning properly, please verify the installation of the component or download it'
The thing is, I have sql server 2005 properly installed on my pc and at the same time, whenever I choose to create a new connection from the server connection or in setting up a connection to the existing databases, I do not face any problem, so why is this issue occuring over here, I have no idea, thanks to anyone willin to resolve!

View 1 Replies View Related

Adding Datetime To Database?

Dec 23, 2005

I have DateCreated with datetime datatype in my SQL Express 2005. I'd like to add the record to my Task table so I have a form in my ASPX and create a button event in my ASPX.CS here is the code protected void Button_AddTask_Click(object sender, EventArgs e)    {        SqlDataSource newTask = new SqlDataSource();        newTask.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();        newTask.InsertCommand = "INSERT INTO [Task] ([MemberAccountName], [Title], [Place], [TaskDetail],[DateCreated]) VALUES (@MemberAccountName, @Title, @Place, @TaskDetail,@DateCreated)";        newTask.InsertParameters.Add("MemberAccountName", User.Identity.Name);        newTask.InsertParameters.Add("Title", TextBox_Title.Text);        newTask.InsertParameters.Add("Place", TextBox_Place.Text);        newTask.InsertParameters.Add("TaskDetail", TextBox_Detail.Text);       newTask.InsertParameters.Add("DateCreated",DateTime.Now.ToString());        newTask.Insert();        Response.Redirect("Default.aspx");    }but I got this errorArithmetic overflow error converting expression to data type datetime.The statement has been terminated.Any idea?

View 5 Replies View Related

Adding Data Into A Database

Jan 15, 2006

I'm new at this and wondering if someone would have the heart to help.I want to know how to add data into a database. Here's the details:I have a sqldatasource( sqldatasource1) attached to a database with a table named customers.The table(customers) has one field named 'Name' with datatype varchar(50)I have a textbox (textbox1) and a button (button1)I want to insert the text into textbox1 into my database. how can i do that?

View 3 Replies View Related

Problem Adding New SQL Database

Apr 12, 2006

Hi !

I have a problem when I try to add new SQL Database. I am using Visual
Web Developer 2005, and when I try to add new item which new SQL
Database, it then asks me if I want to create a folder called
'app_data' to store the database. I click on yes. Then the error
message come out:

Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be
closed.

Anybody please help me out.... thanks a lot in advanced!!

View 2 Replies View Related

Adding An Additional Database

Feb 28, 2001

Hi,

What are all the performance parameters to be analyzed, in an existing production server, to accommodate an additional database.

Regards
Kalyan

View 1 Replies View Related

Adding A User In Every Database

Oct 29, 2001

I am trying to add a user in every database. So far I have tried using a cursor - Wont work because you cannot issue Use @database_name within the cursor. I have also tried master.dbo.sp_MsForeachdb "exec sp_grantdbaccess 'user'" this does not work either as it addes the user to the first database then doesnt cycle through. I also tried fully qualifying the sp_grantdbaccess with master.dbo.sp_grantdbaccess.

If you have a way of doing this i would appreciate some help.

Thanks

Bill

View 4 Replies View Related

Adding Permissions To New Database

Aug 5, 2004

Hi,

When a new Database is created ( some , not all. All that begins with 'PW' ) i want to add a windows-usergroup to it so they can access the DB.
Normally I could do this by adding this user to the model-db but it's not for all DB's that are added (The other DB's must not be accesible for this usergroup ).
The DB's are added by an External App so I have no control over it.

So I was thinking, no problem we can just add a trigger to the master..sysdatabases table and add if necessary the permissions.
Not -> Even with allowupdates = 1 you cannot add a trigger to a system table ( a bit overprotection from ms, should be allowed if you know what you are doing ).

I would like to avoid running a job every x time to look if a new DB has been added, the DB must be available within minutes after creation.

Does anybody has any suggestions ?

Thanks in advance,

Sven Peeters
Belgium

View 3 Replies View Related

Adding Data From A Form To A Database

Nov 15, 2007

Very basic question here but I need to add a form to a page so it adds content, its as simple as that.  I've done this kind of using a <asp.Formview> tag and it works, but becuase I think I've used a form view I have to click add to insert data first.  Should I be using the <asp:formview> tag or is it a problem with the templates?
 <asp:FormView ID="FormView1" runat="server" DataKeyNames="ContentID" DataSourceID="ObjectDataSource1">                                      <InsertItemTemplate>                        Resource :<asp:DropDownList ID="ResourceIDTextBox" runat="server" Text='<%# Bind("ResourceID") %>' DataSourceID="ObjectDataSource2"                            DataTextField="Resource" DataValueField="ResourceID">                        </asp:DropDownList><br />                        Headline:                        <asp:TextBox ID="HeadlineTextBox" runat="server" Text='<%# Bind("Headline") %>' Width="451px"></asp:TextBox><br />                        Date:                        <asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>'>                        </asp:TextBox><br />                        Body:                                        <FTB:FreeTextBox id="FreeTextBox1" runat="Server" Text='<%# Bind("Body") %>' Width="542px" />                        <br />                        ImageURL:                        <asp:TextBox ID="ImageURLTextBox" runat="server" Text='<%# Bind("ImageURL") %>'>                        </asp:TextBox><br />                        OpeningPara:                        <asp:TextBox ID="OpeningParaTextBox" runat="server" Text='<%# Bind("OpeningPara") %>'>                        </asp:TextBox><br />                        Ret:                        <asp:TextBox ID="RetTextBox" runat="server" Text='<%# Bind("Ret") %>'>                        </asp:TextBox><br />                        Man:                        <asp:TextBox ID="ManTextBox" runat="server" Text='<%# Bind("Man") %>'>                        </asp:TextBox><br />                        Pro:                        <asp:TextBox ID="ProTextBox" runat="server" Text='<%# Bind("Pro") %>'>                        </asp:TextBox><br />                        Com:                        <asp:TextBox ID="ComTextBox" runat="server" Text='<%# Bind("Com") %>'>                        </asp:TextBox><br />                        IndustryID:                        <asp:TextBox ID="IndustryIDTextBox" runat="server" Text='<%# Bind("IndustryID") %>'>                        </asp:TextBox><br />                        ContentTitle:                        <asp:TextBox ID="ContentTitleTextBox" runat="server" Text='<%# Bind("ContentTitle") %>'>                        </asp:TextBox><br />                        Status:                        <asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>'>                        </asp:TextBox><br />                        Pub:                        <asp:TextBox ID="PubTextBox" runat="server" Text='<%# Bind("Pub") %>'>                        </asp:TextBox><br />                        Fin:                        <asp:TextBox ID="FinTextBox" runat="server" Text='<%# Bind("Fin") %>'>                        </asp:TextBox><br />                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"                            Text="Insert">                        </asp:LinkButton>                        <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"                            Text="Cancel">                        </asp:LinkButton>                    </InsertItemTemplate>                    <ItemTemplate>                                             <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"                            Text="Click here to Add New Content">                        </asp:LinkButton>                    </ItemTemplate>                </asp:FormView>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"                    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="ContentADDMethod"                    TypeName="DataSet2TableAdapters.ContentADDAdapter" UpdateMethod="Update">                    <DeleteParameters>                        <asp:Parameter Name="Original_ContentID" Type="Int32" />                    </DeleteParameters>                    <UpdateParameters>                        <asp:Parameter Name="ResourceID" Type="Int32" />                        <asp:Parameter Name="Headline" Type="String" />                        <asp:Parameter Name="Date" Type="String" />                        <asp:Parameter Name="Body" Type="String" />                        <asp:Parameter Name="ImageURL" Type="String" />                        <asp:Parameter Name="OpeningPara" Type="String" />                        <asp:Parameter Name="Ret" Type="String" />                        <asp:Parameter Name="Man" Type="String" />                        <asp:Parameter Name="Pro" Type="String" />                        <asp:Parameter Name="Com" Type="String" />                        <asp:Parameter Name="IndustryID" Type="Int32" />                        <asp:Parameter Name="ContentTitle" Type="String" />                        <asp:Parameter Name="Status" Type="String" />                        <asp:Parameter Name="Pub" Type="String" />                        <asp:Parameter Name="Fin" Type="String" />                        <asp:Parameter Name="Original_ContentID" Type="Int32" />                        <asp:Parameter Name="ContentID" Type="Int32" />                    </UpdateParameters>                    <InsertParameters>                        <asp:Parameter Name="ResourceID" Type="Int32" />                        <asp:Parameter Name="Headline" Type="String" />                        <asp:Parameter Name="Date" Type="String" />                        <asp:Parameter Name="Body" Type="String" />                        <asp:Parameter Name="ImageURL" Type="String" />                        <asp:Parameter Name="OpeningPara" Type="String" />                        <asp:Parameter Name="Ret" Type="String" />                        <asp:Parameter Name="Man" Type="String" />                        <asp:Parameter Name="Pro" Type="String" />                        <asp:Parameter Name="Com" Type="String" />                        <asp:Parameter Name="IndustryID" Type="Int32" />                        <asp:Parameter Name="ContentTitle" Type="String" />                        <asp:Parameter Name="Status" Type="String" />                        <asp:Parameter Name="Pub" Type="String" />                        <asp:Parameter Name="Fin" Type="String" />                    </InsertParameters>                </asp:ObjectDataSource>                                                      <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="Insert"                      OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DataSet2TableAdapters.ResourcesTableAdapter">                      <InsertParameters>                          <asp:Parameter Name="Resource" Type="String" />                      </InsertParameters>                  </asp:ObjectDataSource>
 

View 1 Replies View Related

How To Update Database After Adding New Item

Mar 24, 2008

Hello All,
 So I have created a form using VB. I put the add, del, edit, save .....etc buttons.
 When I add and click on save the database does not get updated after closing the form.
I remember in vb6 we used to us dataname.update but the new VS 2005 does not have this  function "update"?

View 4 Replies View Related

Adding A Data File In Database

Feb 11, 2002

We are using SQL server 7.0 as RDBMS for BaaN ERP. We have
created the database file in E: drive. Now E: drive is going to be
exhausted, We are trying to add a new file at different location. When
we add the file into database it creates a file with default extension .ndf
but previous file has the extension .mdf. should we change the extension
of new file to .mdf or we should continue with default extension .ndf.

is it necessary to add a secondary file group or we add a file to the
existing primary group.

thanx in advance

madhu p menon

View 1 Replies View Related

Adding A Member For Database Role

Nov 8, 2000

Hi,

I have a login 'testuser' on test server.
This login was 'db_datareader' for database called 'invent_test' on test server.
I deleted the whole database and restored the production backup as 'invent_test' database.
Now I am trying to modify login 'testuser' by adding it as 'db_datareader' for 'invent_test' again but it gives me an error that 'this user or role already exists for current database'.

I can not see 'db_datareader' or even 'invent_test' options selected in login properties for 'testuser'. Also I can not find 'testuser' in database roles
-->db_datareader member list.
Is this a bug with sql server 7.0? Or how should I give this user priviledges to read?

I dropped the login and recreated it. Server is also rebooted meanwhile so there is no possibility for cashe problem. Still same error is there.
Is there any thing that I am missing here?

I really appreciate your help. I am very frustrated now.

View 2 Replies View Related

Adding A User To A Read-Only Database

Aug 1, 2007

Hey guys,

I currently have a sql server 2000 sp4 instance with a read-only db on it. We get tlogs shipped from an outside vendor and keep a copy of the production database in house for reporting purposes. The database is in read-only mode because we apply new tlogs daily. Recently we did a full recover and applied 2 tlogs.

The issue:
There is a user YYY in the database and at the server level, but they aren't linked. So I do what I usually do and run the following command:

exec sp_change_users_login 'Update_One', 'YYY','YYY'

Except for I get the following error:

Server: Msg 3906, Level 16, State 1, Procedure sp_change_users_login, Line 109
Could not run BEGIN TRANSACTION in database 'ZZZ' because the database is read-only.

Now this error makes sense and I understand why, so my question is how do I fix the users not being linked?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved