Showing posts with label master. Show all posts
Showing posts with label master. Show all posts

Monday, March 19, 2012

newbie needs dataset-sqltable update code

I have dataadapter and dataset that reads/writes to SQL tables.
I can read. I can create "new" records.
However, I have not been able to master the "updating" of an existing row.
Can someone provide me specific code for doing this please or tell me what I doing wrong in the code below.
The code I using is below. I don't get error, but changes do not get written to SQL dbase.
For starters, I think I "not" supposed to use the 2nd line(...NewRow). I think this is only for new row, not updating of existing row - but I don't know any other way to get schema of row.
thanks to any who can help

Dim drow As DataRow
drow = Me.dsRequests1.Tables("REQUESTS").NewRow
drow.BeginEdit()
drow.Item("Request_Name") = Me.txtRequestName.Text
drow.Item("Request_Comments_Txt") = Me.txtRequestComments.Text
drow.Item("Requestor_Contact_Id") = Me.txtRequestor.Text
drow.Item("Request_BigX_Status_Type_Cd") = Me.ddlBigXStatus
drow.Item("Request_Action_Type_Cd") = Me.ddlRequestActionRequested.SelectedItem.Text
drow.EndEdit()
Me.DaREQUESTS.Update(Me.dsRequests1.Tables("REQUESTS"))
Me.dsRequests1.AcceptChanges()You're right
NewRow is only for new rows,
To update an existing row you should find the row in your dataset/datatable - using your table's primary key and find method or by index - change it's values , and update your dataset/datatable
Something like this (if you're using a typed dataset)


Dim drow as DataRow = dsRequests.Requests.findbyprimarykey(myParimaryKeyValue)
drow.property = newValue
daRequests.update(myTable)

hth

Wednesday, March 7, 2012

Newbie ? -- Does 'master' transaction log need to be backed up?

Hope someone can help answer this question for this newbie.
We are running SQL Server 2000 SP3a on Windows Server 2003, all updates current.
We have been running smoothly for some time now with two user databases. The maintenance plans work well for them. The maintenance plans for the system databases, however, have been giving me fits. Occasionally, one or more steps will fail and there is
no information in any log with which to begin an investigation. The Books Online offer no clue, either.
Here's what I need to know:
Most maintenance plans consist of 1 or more options: Optimizations, Integrity Checks, Database Backup, Transaction Log Backup. I have all 4 options set up for my user databases.
For the system databases (master, model, and msdb), the Transaction Log Backup continues to fail for the 'master' database with this error:
Backup can not be performed on this database. This sub task is ignored
The Properties Tab of the 'master' database shows that the Transaction Log file is:
C:\Program Files\Microsoft SQL Server\MSSQL\data\mastlog.ldf
Is there a problem with the database?
Any assistance is greatly appreciated.
Robert
By the way, 'master' is set to FULL recovery
Robert
|||Hi,
You canot perform a Trasaction log backup for MASTER database even though
recovery model is "FULL". Only database backup is possible. Why do you need
to backup the trasnaction log of MASTER database, because it is not advised
to have user tables / transaction tables in system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
> By the way, 'master' is set to FULL recovery
> Robert
>
|||Hari,
Thanks for the information.
We don't use the system databases for user data at all! I merely need to
understand what is involved in a standard daily system maintenance process.
That being said, is it okay to just have the Optimizations, Integrity
Checks, and Database Backup options for those three databases (master, model
and msdb) and forget about the Transaction Log backup for each?
Thanks!
Robert
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
> Hi,
> You canot perform a Trasaction log backup for MASTER database even though
> recovery model is "FULL". Only database backup is possible. Why do you
need
> to backup the trasnaction log of MASTER database, because it is not
advised
> to have user tables / transaction tables in system databases.
> Thanks
> Hari
> MCDBA
> "Robert" <rclay@.kerrdrug.com> wrote in message
> news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
>
|||Hi,
Since you are not adding any trasnactions to System database, you can ignore
the transaction log backup
for system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:#S$Kw28TEHA.3988@.TK2MSFTNGP10.phx.gbl...
> Hari,
> Thanks for the information.
> We don't use the system databases for user data at all! I merely need to
> understand what is involved in a standard daily system maintenance
process.
> That being said, is it okay to just have the Optimizations, Integrity
> Checks, and Database Backup options for those three databases (master,
model[vbcol=seagreen]
> and msdb) and forget about the Transaction Log backup for each?
> Thanks!
> Robert
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
though
> need
> advised
>
|||Thanks, Hari.
I will only backup the Transaction Logs for my user databases, then.
Robert
|||Be aware that the backup history is in the msdb database. Because of this, I also do log backup for msdb. For
some strange reason, MS decided to set msdb to simple recovery mode when agent starts, but I just fix that by
setting msdb to full in an auto-start agent job.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Robert" <rclay@.kerrdrug.com> wrote in message news:%23sbmuX9TEHA.3140@.tk2msftngp13.phx.gbl...
> Thanks, Hari.
> I will only backup the Transaction Logs for my user databases, then.
> Robert
>

Newbie ? -- Does 'master' transaction log need to be backed up?

Hope someone can help answer this question for this newbie
We are running SQL Server 2000 SP3a on Windows Server 2003, all updates current
We have been running smoothly for some time now with two user databases. The maintenance plans work well for them. The maintenance plans for the system databases, however, have been giving me fits. Occasionally, one or more steps will fail and there is no information in any log with which to begin an investigation. The Books Online offer no clue, either
Here's what I need to know
Most maintenance plans consist of 1 or more options: Optimizations, Integrity Checks, Database Backup, Transaction Log Backup. I have all 4 options set up for my user databases
For the system databases (master, model, and msdb), the Transaction Log Backup continues to fail for the 'master' database with this error:
Backup can not be performed on this database. This sub task is ignore
The Properties Tab of the 'master' database shows that the Transaction Log file is
C:\Program Files\Microsoft SQL Server\MSSQL\data\mastlog.ld
Is there a problem with the database
Any assistance is greatly appreciated
RobertBy the way, 'master' is set to FULL recovery
Robert|||Hi,
You canot perform a Trasaction log backup for MASTER database even though
recovery model is "FULL". Only database backup is possible. Why do you need
to backup the trasnaction log of MASTER database, because it is not advised
to have user tables / transaction tables in system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
> By the way, 'master' is set to FULL recovery
> Robert
>|||Hari,
Thanks for the information.
We don't use the system databases for user data at all! I merely need to
understand what is involved in a standard daily system maintenance process.
That being said, is it okay to just have the Optimizations, Integrity
Checks, and Database Backup options for those three databases (master, model
and msdb) and forget about the Transaction Log backup for each?
Thanks!
Robert
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
> Hi,
> You canot perform a Trasaction log backup for MASTER database even though
> recovery model is "FULL". Only database backup is possible. Why do you
need
> to backup the trasnaction log of MASTER database, because it is not
advised
> to have user tables / transaction tables in system databases.
> Thanks
> Hari
> MCDBA
> "Robert" <rclay@.kerrdrug.com> wrote in message
> news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
> > By the way, 'master' is set to FULL recovery
> >
> > Robert
> >
> >
>|||Hi,
Since you are not adding any trasnactions to System database, you can ignore
the transaction log backup
for system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:#S$Kw28TEHA.3988@.TK2MSFTNGP10.phx.gbl...
> Hari,
> Thanks for the information.
> We don't use the system databases for user data at all! I merely need to
> understand what is involved in a standard daily system maintenance
process.
> That being said, is it okay to just have the Optimizations, Integrity
> Checks, and Database Backup options for those three databases (master,
model
> and msdb) and forget about the Transaction Log backup for each?
> Thanks!
> Robert
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > You canot perform a Trasaction log backup for MASTER database even
though
> > recovery model is "FULL". Only database backup is possible. Why do you
> need
> > to backup the trasnaction log of MASTER database, because it is not
> advised
> > to have user tables / transaction tables in system databases.
> >
> > Thanks
> > Hari
> > MCDBA
> >
> > "Robert" <rclay@.kerrdrug.com> wrote in message
> > news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
> > > By the way, 'master' is set to FULL recovery
> > >
> > > Robert
> > >
> > >
> >
> >
>|||Thanks, Hari.
I will only backup the Transaction Logs for my user databases, then.
Robert|||Be aware that the backup history is in the msdb database. Because of this, I also do log backup for msdb. For
some strange reason, MS decided to set msdb to simple recovery mode when agent starts, but I just fix that by
setting msdb to full in an auto-start agent job.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Robert" <rclay@.kerrdrug.com> wrote in message news:%23sbmuX9TEHA.3140@.tk2msftngp13.phx.gbl...
> Thanks, Hari.
> I will only backup the Transaction Logs for my user databases, then.
> Robert
>

Newbie ? -- Does 'master' transaction log need to be backed up?

Hope someone can help answer this question for this newbie.
We are running SQL Server 2000 SP3a on Windows Server 2003, all updates curr
ent.
We have been running smoothly for some time now with two user databases. Th
e maintenance plans work well for them. The maintenance plans for the syste
m databases, however, have been giving me fits. Occasionally, one or more s
teps will fail and there is
no information in any log with which to begin an investigation. The Books O
nline offer no clue, either.
Here's what I need to know:
Most maintenance plans consist of 1 or more options: Optimizations, Integri
ty Checks, Database Backup, Transaction Log Backup. I have all 4 options se
t up for my user databases.
For the system databases (master, model, and msdb), the Transaction Log Back
up continues to fail for the 'master' database with this error:
Backup can not be performed on this database. This sub task is ignored
The Properties Tab of the 'master' database shows that the Transaction Log f
ile is:
C:\Program Files\Microsoft SQL Server\MSSQL\data\mastlog.ldf
Is there a problem with the database?
Any assistance is greatly appreciated.
RobertBy the way, 'master' is set to FULL recovery
Robert|||Hi,
You canot perform a Trasaction log backup for MASTER database even though
recovery model is "FULL". Only database backup is possible. Why do you need
to backup the trasnaction log of MASTER database, because it is not advised
to have user tables / transaction tables in system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
> By the way, 'master' is set to FULL recovery
> Robert
>|||Hari,
Thanks for the information.
We don't use the system databases for user data at all! I merely need to
understand what is involved in a standard daily system maintenance process.
That being said, is it okay to just have the Optimizations, Integrity
Checks, and Database Backup options for those three databases (master, model
and msdb) and forget about the Transaction Log backup for each?
Thanks!
Robert
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
> Hi,
> You canot perform a Trasaction log backup for MASTER database even though
> recovery model is "FULL". Only database backup is possible. Why do you
need
> to backup the trasnaction log of MASTER database, because it is not
advised
> to have user tables / transaction tables in system databases.
> Thanks
> Hari
> MCDBA
> "Robert" <rclay@.kerrdrug.com> wrote in message
> news:uEutur8TEHA.1356@.TK2MSFTNGP09.phx.gbl...
>|||Hi,
Since you are not adding any trasnactions to System database, you can ignore
the transaction log backup
for system databases.
Thanks
Hari
MCDBA
"Robert" <rclay@.kerrdrug.com> wrote in message
news:#S$Kw28TEHA.3988@.TK2MSFTNGP10.phx.gbl...
> Hari,
> Thanks for the information.
> We don't use the system databases for user data at all! I merely need to
> understand what is involved in a standard daily system maintenance
process.
> That being said, is it okay to just have the Optimizations, Integrity
> Checks, and Database Backup options for those three databases (master,
model
> and msdb) and forget about the Transaction Log backup for each?
> Thanks!
> Robert
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:ObCeux8TEHA.4048@.TK2MSFTNGP12.phx.gbl...
though[vbcol=seagreen]
> need
> advised
>|||Thanks, Hari.
I will only backup the Transaction Logs for my user databases, then.
Robert|||Be aware that the backup history is in the msdb database. Because of this, I
also do log backup for msdb. For
some strange reason, MS decided to set msdb to simple recovery mode when age
nt starts, but I just fix that by
setting msdb to full in an auto-start agent job.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Robert" <rclay@.kerrdrug.com> wrote in message news:%23sbmuX9TEHA.3140@.tk2msftngp13.phx.gbl.
.
> Thanks, Hari.
> I will only backup the Transaction Logs for my user databases, then.
> Robert
>

Newbie - What is the CLR Keyword/Method for @@IDENTITY - thanks!

What is the CLR Keyword/Method for @.@.IDENTITY? I'm doing some master detail inserts and when doing the insert for the child records, i need the new key that was generated for the parent records. Thanks!
Think I may have found the answer at the following site,

http://davidhayden.com/blog/dave/archive/2006/02/16/2803.aspx

It basically says that on your insert statement to append the following statement onto the end of the insert statement:

"SET @.MyParameter = SCOPE_IDENTITY()"


And then on your command object to pass in a parameter with the name of @.MyParameter (with Direction set to output) and then access the parameter after executing the command. Haven't tried it yet but hopefully it works. Is this correct as far you guys know? Is there a better way, lemme know, thanks!