Getting Data From Dataset Back Into Database

Sep 7, 2006

I'm new at this so I apologize in advance for my ignorance.

I'm creating a website that collects dates in a calendar control (from Peter Blum). When the page containing the control loads it populates the calendar with dates from the database (that have previously been selected by the user). The user then can delete existing dates and/or add new dates.

I create a dataset when the page loads and use it to populate the calendar. When the user finishes adding and deleting dates in the calendar control I delete the original dates from the dataset and then write the new dates to the dataset. I then give execute the data adapter update command to load the contents of the dataset back into the database. This command involves using parameterized queries. For example the Insert command is:

Dim cmdInsert As SqlCommand = New SqlCommand("INSERT INTO Requests VALUES(@fkPlayerIDNumber, @RequestDate, @PostDate, @fkGroupID)", conn)

cmdInsert.Parameters.Add(New SqlParameter("@fkPlayerIDNumber", SqlDbType.Int))

cmdInsert.Parameters.Add(New SqlParameter("@RequestDate", SqlDbType.DateTime))

cmdInsert.Parameters.Add(New SqlParameter("@PostDate", SqlDbType.DateTime))

cmdInsert.Parameters.Add(New SqlParameter("@fkGroupID", SqlDbType.Int))

da.InsertCommand = cmdInsert

The update command is:

da.Update(ds, "Requests")

When I run the program I get the following error:

Parameterized Query '(@fkPlayerIDNumber int,@RequestDate datetime,@PostDate datetime,' expects parameter @fkPlayerIDNumber, which was not supplied.

I've used debug print to establish that the table in the dataset contains what it should.

I would be more than grateful for any suggestions.

View 3 Replies


ADVERTISEMENT

Pull Back Data Using A Dataset

Feb 19, 2008

Hello, I am trying to pull run this sql statement but it's bombing out at the comm.ExecuteNonQuery();. ..
 
Could someone help me figure this out..
 Ex.System.Int32 bum = System.Convert.ToInt32(Request.QueryString["dum"]);
SqlConnection conn = new SqlConnection("Data Source=**********************");SqlCommand comm = new SqlCommand();
comm.Connection = conn;SqlDataAdapter myadapter = new SqlDataAdapter(comm);DataSet myset = new DataSet();
conn.Open();
 comm.CommandText = "Select * from Order_Forms where (Order_Num = " + Session["dum1"] + " ) ";
 
comm.ExecuteNonQuery();myadapter.Fill(myset, "Order_Forms");
myset.AcceptChanges();
 
Can yo usee the problem???
 
 
 

View 7 Replies View Related

Problem With Update When Updating All Rows Of A Table Through Dataset And Saving Back To Database

Feb 24, 2006

Hi,
I have an application where I'm filling a dataset with values from a table. This table has no primary key. Then I iterate through each row of the dataset and I compute the value of one of the columns and then update that value in the dataset row. The problem I'm having is that when the database gets updated by the SqlDataAdapter.Update() method, the same value shows up under that column for all rows. I think my Update Command is not correct since I'm not specifying a where clause and hence it is using just the value lastly computed in the dataset to update the entire database. But I do not know how to specify  a where clause for an update statement when I'm actually updating every row in the dataset. Basically I do not have an update parameter since all rows are meant to be updated. Any suggestions?
SqlCommand snUpdate = conn.CreateCommand();
snUpdate.CommandType = CommandType.Text;
snUpdate.CommandText = "Update TestTable set shipdate = @shipdate";
snUpdate.Parameters.Add("@shipdate", SqlDbType.Char, 10, "shipdate");
string jdate ="";
for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
{
jdate = ds.Tables[0].Rows[i]["shipdate"].ToString();
ds.Tables[0].Rows[i]["shipdate"] = convertToNormalDate(jdate);
}
da.Update(ds, "Table1");
conn.Close();
 
-Thanks

View 4 Replies View Related

Write DataSet Back To SQL

Sep 10, 2004

Hello everybody,
I have a dataset that i read from an xml file.
I need to import this database back in to sql..
Is there a easy way.. Or do i need to loop thorugh each record in the dataset to import it.

Thanks

Chris

View 2 Replies View Related

Tables Not Being Written Back To DB From Dataset. I'm Going Nutz!

Sep 26, 2006

ok. the problem: some tables are empty, so i can't be sure why some are updating at the DB and some arent.
I have manually picked thru every line of the xml that i'm reading into the dataset here, and it is fine, data is all valid and everything.
the tables i'm most worried about are bulletins and surveys, but they all have to be imported from my upload, the code steps thru just fine and I've been thru it a million times. Did I miss something in my dataadapter configuration?. 'daBulletin        '        Me.daBulletin.ContinueUpdateOnError = True        Me.daBulletin.DeleteCommand = Me.SqlDeleteCommand17        Me.daBulletin.InsertCommand = Me.SqlInsertCommand17        Me.daBulletin.SelectCommand = Me.SqlSelectCommand25        Me.daBulletin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "tblBulletin", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("BulletinID", "BulletinID"), New System.Data.Common.DataColumnMapping("ContractID", "ContractID"), New System.Data.Common.DataColumnMapping("Msg_Type", "Msg_Type"), New System.Data.Common.DataColumnMapping("DatePosted", "DatePosted"), New System.Data.Common.DataColumnMapping("Subject", "Subject"), New System.Data.Common.DataColumnMapping("B_Body", "B_Body"), New System.Data.Common.DataColumnMapping("I_Read_It", "I_Read_It"), New System.Data.Common.DataColumnMapping("DateRead", "DateRead")})})        Me.daBulletin.UpdateCommand = Me.SqlUpdateCommand16
  here is my merge function: Private Function Merge(ByVal sFilename As String, ByVal User As String) As String
        Dim connMerge As New SqlConnection(ConnectionString)
        Dim dsNew As New dsBeetleTracks
        Dim dsExisting As New dsBeetleTracks
        Dim strResult As String
        SetConnections(connMerge)
        Dim idc As New System.Security.Principal.GenericIdentity(User)
        Dim currentUser As BeetleUser = bu

        dsNew.ReadXml(sFilename)

        If currentUser.IsInRole("Admin") Or currentUser.IsInRole("QA") Then
            If dsNew.tblBulletin.Count > 0 Then
                daBulletin.Fill(dsExisting.tblBulletin)
                dsExisting.Merge(dsNew.tblBulletin)
                strResult += daHelipads.Update(dsExisting.tblBulletin).ToString + " Bulletins updated<br>"
            End If
        End If

        If dsNew.tblHours.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Admin")) Then
            daHours.Fill(dsExisting.tblHours)
            dsExisting.Merge(dsNew.tblHours)

            strResult += daHours.Update(dsExisting.tblHours).ToString + " hours updated<br>"
        End If

        If dsNew.tblHeliPads.Count > 0 Then
            daHelipads.Fill(dsExisting.tblHeliPads)
            dsExisting.Merge(dsNew.tblHeliPads)
            strResult += daHelipads.Update(dsExisting.tblHeliPads).ToString & " helipads updated "
        End If

        If dsNew.tblExpenses.Count > 0 Then
            daExpenses.Fill(dsExisting.tblExpenses)
            dsExisting.Merge(dsNew.tblExpenses)

            strResult += daExpenses.Update(dsExisting.tblExpenses).ToString + " expenses updated<br>"
        End If

        If dsNew.tblPersons.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then
            daPersons.Fill(dsExisting.tblPersons)
            dsExisting.Merge(dsNew.tblPersons)
            strResult += daPersons.Update(dsExisting.tblPersons).ToString + " persons updated<br>"
        End If

        If currentUser.IsInRole("Field") Then
            daSurveys.SelectCommand.CommandText = "exec Surveys_Field_Select"
            daSurveys.InsertCommand.CommandText = "exec Surveys_Field_Insert"
            daSurveys.UpdateCommand.CommandText = "exec Surveys_Field_Update"
        End If

        If dsNew.tblSurveys.Count > 0 And (currentUser.IsInRole("Survey") Or currentUser.IsInRole("Field")) Then ' Or CurrentUser.IsInRole("Admin")) Then

            daSurveys.Fill(dsExisting.tblSurveys)
            dsExisting.Merge(dsNew.tblSurveys)

            strResult += daSurveys.Update(dsExisting.tblSurveys).ToString + " surveys updated<br>"
        End If

        If dsNew.tblSurveyChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then
            daSurveyChecks.Fill(dsExisting.tblSurveyChecks)
            dsExisting.Merge(dsNew.tblSurveyChecks)

            strResult += daSurveyChecks.Update(dsExisting.tblSurveyChecks).ToString + " survey checks updated<br>"
        End If

        If dsNew.tblTreatments.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Admin")) Then
            daTreatments.Fill(dsExisting.tblTreatments)
            dsExisting.Merge(dsNew.tblTreatments)

            strResult += daTreatments.Update(dsExisting.tblTreatments).ToString + " treatments updated<br>"
        End If

        If dsNew.tblInternalQC.Count > 0 And (currentUser.IsInRole("FB") Or currentUser.IsInRole("Heli-burn") Or currentUser.IsInRole("Survey")) Then ' Or CurrentUser.IsInRole("Admin")) Then
            daInternalQC.Fill(dsExisting.tblInternalQC)
            dsExisting.Merge(dsNew.tblInternalQC)

            strResult += daInternalQC.Update(dsExisting.tblInternalQC).ToString + " internalqc updated<br>"
        End If

        If dsNew.tblTreatmentChecks.Count > 0 And (currentUser.IsInRole("QA") Or currentUser.IsInRole("Admin")) Then
            Try
                daTreatmentChecks.Fill(dsExisting.tblTreatmentChecks)
                dsExisting.Merge(dsNew.tblTreatmentChecks)
                strResult += daTreatmentChecks.Update(dsExisting.tblTreatmentChecks).ToString + " treatment checks updated<br>"
            Catch dbex As DBConcurrencyException
                strResult += vbCrLf & dbex.Message
                For x As Integer = 0 To dbex.Row.Table.Columns.Count - 1
                    strResult += vbCrLf & dbex.Row.GetColumnError(x)
                Next
            End Try
        End If

        If dsNew.tblHeliPiles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' Or CurrentUser.IsInRole("Planner")CurrentUser.IsInRole("QA") Or CurrentUser.IsInRole("Admin") Or
            daHeliPiles.Fill(dsExisting.tblHeliPiles)
            dsExisting.Merge(dsNew.tblHeliPiles)

            strResult += daHeliPiles.Update(dsExisting.tblHeliPiles).ToString + " piles updated<br>"
        End If

        If dsNew.tblHeliCycles.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then ' CurrentUser.IsInRole("Planner") Or Or CurrentUser.IsInRole("Admin")) Then
            daHeliCycles.Fill(dsExisting.tblHeliCycles)
            dsExisting.Merge(dsNew.tblHeliCycles)

            strResult += daHeliCycles.Update(dsExisting.tblHeliCycles).ToString + " cycles updated<br>"
        End If

        If dsNew.tblHeliTurns.Count > 0 And (currentUser.IsInRole("Heli-burn")) Then 'CurrentUser.IsInRole("Admin") Or CurrentUser.IsInRole("Planner") Or
            daHeliTurns.Fill(dsExisting.tblHeliTurns)
            dsExisting.Merge(dsNew.tblHeliTurns)

            strResult += daHeliTurns.Update(dsExisting.tblHeliTurns).ToString + " turns updated<br>"
        End If

        If dsExisting.HasChanges Then
            dsExisting.Merge(dsNew)
        End If
        dsExisting.AcceptChanges()


        'duh.
        'If dsNew.HasChanges Then
        '    dsNew.AcceptChanges()
        'End If
        If dsExisting.HasErrors Then
            Dim bolError As Boolean
            Dim tempDataTable As DataTable
            bolError = True

            strResult += "<br>"

            For Each tempDataTable In dsExisting.Tables
                If (tempDataTable.HasErrors) Then
                    strResult += PrintRowErrs(tempDataTable)
                End If
            Next
        End If

        dsNew.Dispose()
        dsExisting.Dispose()
        connMerge.Close()
        'edebugging will only track strresult
        Dim fsError As New FileStream(Server.MapPath("./incoming/error.txt"), FileMode.Create, FileAccess.Write)
        Dim swError As New StreamWriter(fsError)
        swError.WriteLine("--==ERROR LOG==--")
        swError.WriteLine(Now.Date.ToShortDateString)
        swError.WriteLine("-----------------")
        swError.WriteLine(strResult)
        swError.Close()
        fsError.Close()

        Return strResult
    End Function

View 2 Replies View Related

How Can I Retrieve The Data Back Into The Webform From The Database?

Feb 27, 2008

Hi,I m using vwd2005 and sql express,c#.I have a question here.In my database i have a table named Table1(id,name,age,country,email,phone) The values for these fields are inserted from the webform.Id is auto generated.name and age is passed from the textbox within the webform.country is passed from dropdownlist within the webform.email and phone is passed from listbox(multiple email and phone) within the webform.Now my problem is i want to retrieve all these row values back into the textboxes,dropdownlist and listbox at the same timeon the click of the retrieve button within the web form . Further more i want to make few changes on it and update the database on the click of another button update within the form.I hope u are getting it.How would the query would be in this case.?can u demonstrate the concept in one simple running example along with code?thanks.jack. 

View 3 Replies View Related

**I M Not Able To RETRIEVE Data Back Into Webform From The Database?

Mar 25, 2008

Hello Everyone,I 've trying to retreive data back into webform from the database from past couple of weeks.But i m not able to retrieve it completely.Here is my scenario.I've tried to explain in detail but in simple language.I hope u will get my point.Ok here it is.plz run my code:-i have three tables in sql.they are:-grup(id,grp)      (1,abc)      (2,xyz)      organization(id,oid,gid,organisation,orgphone)                  (1,1,1,ibm,1234567)                  (2,1,2,microsoft,6543210)                  (3,2,1,oracle,7654323)                  (4,2,2,apple,9876543)  userform(id,title,name,address,email,organizationid)              (1,mr,jack,usa,jack@jack.com,1) userform.aspx page<%@ Page Language="C#" AutoEventWireup="true" CodeFile="userform.aspx.cs" Inherits="userform" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="server">    <div>        <div style="text-align: center">            <table>                <tr>                    <td style="width: 100px">                        Title</td>                    <td style="width: 100px">                        <asp:DropDownList ID="DropDownList1" runat="server">                            <asp:ListItem>mr</asp:ListItem>                            <asp:ListItem>miss</asp:ListItem>                            <asp:ListItem>ms</asp:ListItem>                        </asp:DropDownList></td>                </tr>                <tr>                    <td style="width: 100px">                        Name</td>                    <td style="width: 100px">                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>                </tr>                <tr>                    <td style="width: 100px">                        Add</td>                    <td style="width: 100px">                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>                </tr>                <tr>                    <td style="width: 100px; height: 26px;">                        Email</td>                    <td style="width: 100px; height: 26px;">                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>                </tr>            </table>        </div>        </div>        <div style="text-align: center">            <div>                <div>                    <asp:ScriptManager ID="ScripManager1" runat="server">                    </asp:ScriptManager>                    <div>                        <table>                            <tr>                                <td style="width: 100px">                        Group</td>                                <td style="width: 100px">                                   
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl1_SelectedIndexChanged">                                    </asp:DropDownList></td>                            </tr>                        </table>                        &nbsp;</div>                    <div>                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">                            <ContentTemplate>                                <table>                                    <tr>                                        <td>                        Organisation&nbsp;</td>                                        <td>                                           
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddl2_SelectedIndexChanged">                                            </asp:DropDownList>&nbsp;                                        </td>                                    </tr>                                    <tr>                                        <td>                        org-phone&nbsp;</td>                                        <td>                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>&nbsp;</td>                                    </tr>                                    <tr>                                        <td>                                        </td>                                        <td>                                           
<asp:TextBox ID="TextBox5" runat="server"
Width="45px"></asp:TextBox></td>                                    </tr>                                </table>                            </ContentTemplate>                            <Triggers>                                <asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" />                            </Triggers>                        </asp:UpdatePanel>                        <br />                        <table>                            <tr>                                <td style="width: 100px">                        <asp:Button ID="Button1" runat="server" Text="save" OnClick="Button1_Click" />                                </td>                                <td style="width: 100px">                                    <asp:Button ID="Button3" runat="server" Text="update" /></td>                                <td style="width: 100px">                        <asp:Button ID="Button2" runat="server" Text="cancel" /></td>                            </tr>                        </table>                    </div>                </div>            </div>        </div>    </form></body></html>userform.cs page public partial class userform : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        if (!Page.IsPostBack)        {            AssignDDLDataSource();            ddl1_SelectedIndexChanged(null, null);        }    }        private void AssignDDLDataSource()    {                // SqlConnection             string sqlQry = "SELECT GRP DISPMEM, ID VALMEM FROM GRUP";        SqlCommand cmd = new SqlCommand(sqlQry, con);        ddl1.DataSource = cmd.ExecuteReader();        ddl1.DataTextField = "DISPMEM";        ddl1.DataValueField = "VALMEM";        ddl1.DataBind();    }    protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)    {        AssignSubjectDDL(ddl1.SelectedValue);    }    private void AssignSubjectDDL(string val)    {       // SqlConnection        string sqlQry = "SELECT ORGANISATION DISPMEM, GID VALMEM FROM ORGANIZATION where OID = '" + val + "'";        SqlCommand cmd1 = new SqlCommand(sqlQry, con);        ddl2.DataSource = cmd1.ExecuteReader();        ddl2.DataTextField = "DISPMEM";        ddl2.DataValueField = "VALMEM";        ddl2.DataBind();        ddl2_SelectedIndexChanged(null, null);    }    protected void ddl2_SelectedIndexChanged(object sender, EventArgs e)    {        AssignTextBoxValues(ddl1.SelectedValue, ddl2.SelectedValue);    }    private void AssignTextBoxValues(string teamval, string memval)    {         // SqlConnection       
string sqlQry = "Select ID,ORGANISATION,ORGPHONE from ORGANIZATION
where OID = '" + teamval + "' AND GID = '" + memval + "'";        SqlCommand cmd = new SqlCommand(sqlQry, con);        SqlDataReader rdr = cmd.ExecuteReader();        while (rdr.Read())        {            TextBox5.Text = rdr["ID"].ToString().Trim();            TextBox4.Text = rdr["ORGPHONE"].ToString().Trim();        }    }    protected void Button1_Click(object sender, EventArgs e)    {       // SqlConnection       
string sqlQry = "INSERT into USERFORM (title, name, address, email,
organizationid) VALUES(@title,@name,@address,@email,@organizationid)";        SqlCommand cmd = new SqlCommand(sqlQry, con);        cmd.CommandType = CommandType.Text;        cmd.Parameters.AddWithValue("title", DropDownList1.SelectedValue.Trim());        cmd.Parameters.AddWithValue("name", TextBox1.Text);        cmd.Parameters.AddWithValue("address", TextBox2.Text);        cmd.Parameters.AddWithValue("email", TextBox3.Text);        cmd.Parameters.AddWithValue("organizationid", TextBox5.Text);        cmd.ExecuteNonQuery();        Response.Redirect("detailsview.aspx");    }} detailsview.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="detailsview.aspx.cs" Inherits="detailsview" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="server">    <div>        <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" EnablePagingCallbacks="True"            Height="50px" HorizontalAlign="Center" Width="125px">        </asp:DetailsView>        </div>    </form></body></html> detailsview.cspublic partial class detailsview : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        //SqlConnection        
string str = "select title,name,address,email,grp,organisation,orgphone
from userform as a inner join organization as b on
a.organizationid=b.id inner join grup as c on b.oid=c.id";        SqlDataAdapter oda = new SqlDataAdapter(str, conn);        conn.Open();        DataSet ods = new DataSet();        oda.Fill(ods, "info");        DetailsView1.DataSource = ods.Tables["info"].DefaultView;        DetailsView1.DataBind();              }}My problem :-Now when user fills up the userform and clicks the save button the details are shown in the details view.Now i want to add a Edit hyperlink next to the records in the detailsview so that when i click on it i would be redirected to userform.aspx form with all the textboxes,dropdownlist etc be populated from the related data from the database.(here table userform).Now i want to edit these data in the userform.aspx page and finally when i click the update button at end i want all the data be updated in the database aswell as in details view too.at the same time i want this form to redirect to detailsview.aspx .i hope ur getting it?i m able to do partial part only.Not completely. So can u now  help me modify the code accordingly?Thanks in advance.Jack.  

View 4 Replies View Related

How To Correctly Propogate Data Back To The Database

Jul 23, 2005

I have the following code but do not know the best way to return the updatedDataTable back to the database. I believe I can use the Update method of theData Adapter, BUT if true, I also believe I have to 'long-hand' write codefor each individual column data that's being added......this seems a bitdaft considering that the data is already in the disconnected data table.Have I lost the plot?? Based on the code below, what is the correctapproach?Note: sqlcnn is defined at module level.Public Sub AddRequest(ByVal Eng As String, ByVal Bran As String, ByVal ReqAs String) Implements IHelpSC.AddRequestDim dtNew As New DataTable("dtNew")Dim drNew As DataRowsqlda = New SqlDataAdapter("SELECT * FROM ActiveCalls", sqlcnn)sqlda.Fill(dtNew)'Add and populate the new datarow with'data passed into this subroutinedrNew = dtNew.NewRowdrNew("CallTime") = Format(Date.Now, "dd MMM yyyy").ToStringdrNew("Engineer") = EngdrNew("Branch") = BrandrNew("Request") = ReqdtNew.Rows.Add(drNew)End SubHope one of you wizards can help.Rgds.....and Merry Christmas.Phil

View 2 Replies View Related

How To Transfer Back Data To Production Database

Nov 19, 2015

I have question regarding SQL Transactional Replication methodology

1. Let's say successfully created SQL Transactional Replication and running / transferring data from publisher to subscriber

2. Now one day the source production / publisher SQL Server is down and the remaining DR SQL Server is up (subscriber)

3. Next day, we fixed and bring up the production / publisher SQL Transactional Replication server, then how can we sync back all existing data records from subscriber into publisher side ?

View 3 Replies View Related

Mirroring :: Principal Database Get Role Back After Being Back On Line

May 14, 2015

New to Database Mirroring and I have a question about the Principal database server. I have a Database Mirroring setup configured for High-safety with automatic fail over mode using a witness.

When a fail over occurs because of a lost of communication between the principal and mirror, the mirror server takes on the roll of Principal. When communication is returned to the Principal server, at some point does the database that was the previous Principal database automatically go back to being the Principal server?

View 2 Replies View Related

How Do I Restore Sql Server Database Primary Data Back .mdf

Feb 12, 2007

 
Hello guys
My server crashed  but luckily  I was not able to get back my files with help of recovery software.
Now, all I have from the database are just sql server database primary data .mdf and sql server databaseTransaction Log Files .ldf. I need to restore  these data back to sql server.

Please could someone tell me how to restore these two file types back to my sql sever 2007 database?
Thanks
netboy
 
 

View 3 Replies View Related

Data Access :: Cannot Open Database After Changing Its Name And Change Back To Its Original Name

Sep 3, 2015

I cannot open now my database after changing it name from the folder where it is save and also changed back to its original name.Message recovery pending now is appearing as shown below.Any chance that I could recover my database back?

View 17 Replies View Related

Insert Unicode Data Into The Database With Typed DataSet

Dec 11, 2006

Hi all,I am using a Strongly Typed DataSet (ASP.NET 2.0) to insert new data into a SQL Server 2000 database, types of some fields in db are nvarchar. All thing work fine except I can not insert unicode data(Vietnamese language) into db.I can't find where to put prefix N. Please help me!!!   

View 1 Replies View Related

4 Layered Web Application For Inserting Data Into A Database Using Sql Server As The Back End And A Web Form As The Front End Using C#

Dec 10, 2005

4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C# .
Can someone provide with code as I am new to this architecture and framework.
Better send email.
Thanks In Advance,
A New Bie

View 1 Replies View Related

How To Transfer Data From One Dataset To Other Dataset

Apr 11, 2008

i have two datasets.one dataset have old data from some other database.second dataset have original data from sql server 2005 database.both database have same field having id as a primary key.i want to transfer all the data from first dataset to new dataset retaining the previous data but if old dataset have the same id(primary key) as in the new one then that row will not transfer.
but if the id(primary key) have changed values then the fields updated with that data.how can i do that.
 

View 4 Replies View Related

Inserting Data To Text File From Database And Inserting Data Back To Database From Text File

Aug 7, 2007

Hello friends....
I am looking for 2 things(using c#.net or vb.net and sql svr 2000)
1.convert data from sql server 2000 database (say customers table from northwinds database) to a text file(separated by commas or just plain space)
2.Insert the data from text file back to database.
Can someone pls give me the detailed code to achieve this....really need this on urgent basis.......Thank You.

View 10 Replies View Related

The Log File For Database 'Home_alone' Is Full. Back Up The Transaction Log For The Database To Free Up Some Log Space.

Feb 4, 2008



Hi all

Iam working in Prodcution ENV,Please help how make space


The log file for database 'Home_alone' is full. Back up the transaction log for the database to free up some log space.

View 10 Replies View Related

I Want To Revert Back To Original State Of Database Before I Performed Restore Database

Nov 15, 2006

Hello,i am in great trouble. I want to revert back to original state ofdatabase before i performed restore database on my sql server 2KDatabase. Accidently i didn't take backup of my Database and i didrestore, so is there any way to get the original state back of myDatabase?Any suggestion will be highly appriciated.Regards,S. Domadia.

View 2 Replies View Related

Edited Data Won't Propagate Back To The Database (VB 2005 Express &&amp; SQL Server 2005 Express)

Dec 11, 2006



Hi,

I'm trying to learn some VB programming with the VB 2005 Express Absolute Beginner Series video tutorials (which I think is great) and have come across a problem that I can't solve.

When I follow the instructions in Lesson 9 (Databinding Data to User Interface Controls) my application will display the data from the database correctly and I can edit it (and as long as the debugger is running the data remains changed). However, the changes won't propagate back to the database. I don't get any error messages but after I edit the data, save (with the save button on the BindingNavigator toolbar), and end debugging the data in my database remains unchanged. When I use a MessageBox to show how many rows where edited/updated in the

Me.myTableTableAdapter.Update(Me.myDatabaseDataSet.myTable)

I get the correct number back. I'm sure the problem is not due to coding errors since I've also tried running the accompanying Lesson 9 project file that can be downloaded from MSDN and the problem persists.

I'm using Windows XP SP2, SQL Server 2005 Express Edition and VB 2005 Express Edition. I've tried installing SQL Server 2005 Express with a number of different settings, including default settings, but it doesn't make any difference.

Would greatly appreciate any feedback on this as I'm keen to resolve this problem so I can get on with the next tutorial lesson.

Thanks,
Ieyasu

View 6 Replies View Related

Updating A Production Database With Back Up Of Development Database

May 11, 2007

Can someone provide a step by step tutorial for this? I'd like to safely update a database that is used for a website without much or any downtime.

View 1 Replies View Related

Is There Any Way To Train A Portion Of A Training Data Set From A Selected Dataset For Data Mining?

Jun 19, 2007

Hi, all experts here,



I am wondering is there any way to select only a portion of a data set to train the mining model? In this case, I mean we dont need to split the dataset in advance, what I want to do is being able to select any random portion of a selected dataset to train a mining model. Any advices?



I am looking forward to hearing from you and thanks a lot in advance for your advices and help.



With best regards,



Yours sincerely,



View 3 Replies View Related

Asp.net Page Is Unable To Retrieve The Right Data Calling The Store Procedure From The Dataset/data Adapter

Apr 11, 2007

I'm trying to figure this out
 I have a store procedure that return the userId if a user exists in my table, return 0 otherwise
------------------------------------------------------------------------
 Create Procedure spUpdatePasswordByUserId
@userName varchar(20),
@password varchar(20)
AS
Begin
Declare @userId int
Select @userId = (Select userId from userInfo Where userName = @userName and password = @password)
if (@userId > 0)
return @userId
else
return 0
------------------------------------------------------------------
I create a function called UpdatePasswordByUserId in my dataset with the above stored procedure that returns a scalar value. When I preview the data from the table adapter in my dataset, it spits out the right value.
But when I call this UpdatepasswordByUserId from an asp.net page, it returns null/blank/0
 passport.UserInfoTableAdapters oUserInfo = new UserInfoTableAdapters();
Response.Write("userId: " + oUserInfo.UpdatePasswordByUserId(txtUserName.text, txtPassword.text) );
 Do you guys have any idea why?
 
 

View 6 Replies View Related

New Database Not Included In Back Up Database Task

Aug 10, 2007

I'm having a problem with a Maintenance Plan created for SQL Server 2005 using Microsoft SQL Server Management Studio. See version information at the bottom of this post.

I have a Maintenance Plan using the "Back Up Database Task" that is set to perform a "Full" back up of "All Databases" on the local server. However, it appears that the list of "All databases" are hard-coded to be those databases that were available at the time the task was created. It seems any newly created databases don't appear to be in the list. If I attempt to edit the task and select the "These databases:" option, the newly created databases aren't even in the list.

Is there some way to have the task refresh the list of the databases available for backup? Ideally, I'd like any newly created databases to get backed up automatically without having to modify the task.

Thanks for your help,

Jonathan.


Microsoft SQL Server Management Studio 9.00.3042.00
Microsoft Analysis Services Client Tools 2005.090.3042.00
Microsoft Data Access Components (MDAC) 2000.086.3959.00 (srv03_sp2_rtm.070216-1710)
Microsoft MSXML 2.6 3.0 4.0 6.0
Microsoft Internet Explorer 7.0.5730.11
Microsoft .NET Framework 2.0.50727.42
Operating System 5.2.3790

View 6 Replies View Related

Database Back Up

Mar 27, 2008

Can any body help with sample code to backup (sql server 2005 express)database using VB.net on click of a button?
Thanks

View 2 Replies View Related

Regarding Sql Database Back

Apr 24, 2008

hi can any one guide me how to take database back up from sql server 2005 using visual studio frame work 2008

View 2 Replies View Related

Back Up Database

Nov 8, 2005

Hi everyone,
I am working in a company where data is changed daily (IT department of a shopping center) where item prices change everyday, the quantity available in stock vary daily,...What is the scenarios available for the back up on SQL Server 2000 (I am a developer not a database administrator, but I have a task to do which is to make a back up for the critical data) .
could u help me with some links or idea.I was thinking of doing a full back up one time everyweek and daily I will do a differential backup?is that the best solution?Thanks.

View 1 Replies View Related

Having Difficulty Setting Back Up To Back Up File Wihout Datetime Stamp SQL 2K

Apr 24, 2007

Hello,I'm trying to create a simple back up in the SQL Maintenance Plan that willmake a single back up copy of all database every night at 10 pm. I'd likethe previous nights file to be overwritten, so there will be only a singleback up file for each database (tape back up runs every night, so each daysback up will be saved on tape).Every night the maintenance plan makes a back up of all the databases to anew file with a datetime stamp, meaning the previous nights file stillexists. Even when I check "Remove files older than 22 hours" the previousnights file still exists. Is there any way to create a back up file withoutthe date time stamp so it overwrites the previous nights file?Thanks!Rick

View 5 Replies View Related

Reporting Services :: Run Two Reports Back To Back Without Page Eject?

Jun 9, 2015

I need to run two reports each of A5 Size to run back to page and print on single A4 paper means in 1st half Sale bill will be printed and in second half Gate Pass Will Be Printed both report will be on same page and size and shape should be maintained. How to do it.

View 4 Replies View Related

Problem In Back-up Database

Dec 8, 2004

Hi, i have one database question here. Let me describe my situation first:

i have two different hard disk drives, here i call it HDD1 and HDD2. i want to format my HDD1, but all my database tables are stored in HDD1. i want to know is there any way for me to backup my database table to HDD2, and restore it back later to HDD1.

thanks to you all.

View 3 Replies View Related

Back Up Database To A Different Server

Mar 26, 2001

I am trying to back up database to a different server. I am able to map the serve to my current ones, however, when I go to Enterprise Manager - back up DB, I can not see the mapped drive from back up file location, I wasn't able to see any other disk location but the local drives.

Can somebody tell me how can I back up database to a different server from Enterprise Manager or any syntax?

Thanks.

View 10 Replies View Related

How To Back Up The Transaction Log For The Database?

Feb 8, 2001

Hi all,
I'm getting the following error message in NT event view:

Error: 9002, Severity: 17, State: 2
The log file for database 'db_sys' is full. Back up the transaction log for the database to free up some log space.

But I don't know how to back up the transaction log for the database.
Do I need TRUNCTE LOG (in E.M) to free up some log space?
I only know back up all the database using ALL TASKS -> BACKUP DATABASE in E.M. Please help me. Thanks in advance.
TH

View 1 Replies View Related

HELP!!! Can Not Restore Database From Only Back Up I Have

Jul 10, 2006

I had to transfer my database from one server to another. Both are running SQL 2000. I backed the database up and moved it to the new server however when I try to do a restore I get the following message:

The media set for database "xxx' has 2 family members but only 1 are provided. RESTORE DATABASE is terminating abnormally.

I did some searching and found a couple of posts that mentioned something about the back up including 2 files.

My problem is that the machine I backed this up from crashed when it was shut down and would not reboot so all of the data and the original database do not exist. Is there any hope of restoring this database. It is pretty critical.

Thanks,

Melissa :-)

View 20 Replies View Related

How To Get The RDL Back From The ReportServer Database?

Feb 8, 2008



Hi,

I have a report deployed and working. Now I need to change it but I lost the source (RDL).

Can I get the RDL back from the reportServer database? How?

Help is really appreciated

Tks in advance,
DD


P.S: I'm Using SQL Server 2000

View 3 Replies View Related







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