Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Wednesday, March 7, 2012

Compact Database Error Code: 0

I am currently working in VB.NET with SQL Mobile 2005. I am trying to compact a database, .sdf, using the SqlCeEngine Object compact(connectionstring). When I use this code to compact a small database, only about 300KB, it returns okay however when I try to compact a larger database, about 9MB, it returns with a SQL Error Code: 0, "The operation completed successfully" however with no compacted database. The code works however it only seems to work for smaller databases. Does anyone have any ideas on how to correct this error or tell me why it returns with that type of error.

Snuggs

I am able to compact the database of size nearly 21 MB in our lab. Is it possible for you to share the repro for us to diagnose.

Thanks,

LaxmI NRO, MSFT, SQL Mobile, Microsoft Corporation

|||What do I need to do in order to give you the repro, do you mean just an actual copy of the database itself or something else?|||

Yes actual copy of the database itself. Before sharing it to me, can you check whether the DB is in correct state. compact.exe /verify would let you know if there any bad pages in the DB.

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||The DB is in the correct state. Do you have a direct email address that I can send this to you because this will not let me send this as an attachment.|||Please send it to l-a-x-m-i-n-r-o-A-T-m-i-c-r-o-s-o-f-t-D-O-T-c-o-m Please also paste this question link in the mail for the context. Thanks, Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation|||

Hi Snuggs,

As per our conversation I could see that you have opened a bug here in Product Feedback center. http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=d0f14331-1b05-418a-9a11-2378457e4eb8

And as mentioned we could not repro. We are able to compact the DB very easily with a sample C# program mentioned in the above URL.

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

Compact Database Error Code: 0

I am currently working in VB.NET with SQL Mobile 2005. I am trying to compact a database, .sdf, using the SqlCeEngine Object compact(connectionstring). When I use this code to compact a small database, only about 300KB, it returns okay however when I try to compact a larger database, about 9MB, it returns with a SQL Error Code: 0, "The operation completed successfully" however with no compacted database. The code works however it only seems to work for smaller databases. Does anyone have any ideas on how to correct this error or tell me why it returns with that type of error.

Snuggs

I am able to compact the database of size nearly 21 MB in our lab. Is it possible for you to share the repro for us to diagnose.

Thanks,

LaxmI NRO, MSFT, SQL Mobile, Microsoft Corporation

|||What do I need to do in order to give you the repro, do you mean just an actual copy of the database itself or something else?|||

Yes actual copy of the database itself. Before sharing it to me, can you check whether the DB is in correct state. compact.exe /verify would let you know if there any bad pages in the DB.

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

|||The DB is in the correct state. Do you have a direct email address that I can send this to you because this will not let me send this as an attachment.|||Please send it to l-a-x-m-i-n-r-o-A-T-m-i-c-r-o-s-o-f-t-D-O-T-c-o-m Please also paste this question link in the mail for the context. Thanks, Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation|||

Hi Snuggs,

As per our conversation I could see that you have opened a bug here in Product Feedback center. http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=d0f14331-1b05-418a-9a11-2378457e4eb8

And as mentioned we could not repro. We are able to compact the DB very easily with a sample C# program mentioned in the above URL.

Thanks,

Laxmi NRO, MSFT, SQL Mobile, Microsoft Corporation

Sunday, February 12, 2012

command line

Using Query Analyzer, I can right click on an object and select "script
object to new window as create" and I get the text of the object's
definition (schema). Can I get same result from command line, i.e., from
osql, I can get text output for the definition of the object (something like
defncopy under Sybase)? If so, what is the command or store procedure name?

Thanks in advance.Unfortunately not. You can look at scptxfr.exe (it's installed with
MSSQL server - run it with /? to see the options), which is a
command-line tool used during an upgrade process. But it's not
documented, and it doesn't give you the same flexibility as the QA/EM
scripting fucntionality.

The best general solution is probably to write your own scripts using
the SQLDMO COM interface, which exposes .Script methods for all MSSQL
objects - the details are in Books Online. Or there are plenty of
third-party tools to do this as well.

Simon|||Hi Dav,

Take a look at this sample. I guess this helps you. It is really good.

http://www.databasejournal.com/feat...10894_3401081_1

Thank you
Raju

Command Behavior

I get the error " 'commandBehavior' not declared". What does this mean? What is CommandBehavior exactly?

'
Sub Page_Load(Sender As Object, e As EventArgs)

' Obtain categoryId from QueryString
Dim connectionString As String = "server=(local); trusted_connection=true; database=SalesSide"
Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "Select tblIdent.fldStockNo, tblIdent.fldProgram, tblIdent.fldGenus" & _
"tblIdent.fldVariety, tblIdent.fldSize, tblAvailability.fldQuantity" & _
"FROM tblIdent INNER JOIN tblIdent On tblAvailability.fldStockNo = tblIdent.fldStockNo"

Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)

sqlConnection.Open

dgAvailability.DataSource = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection)
dgAvailability.DataBind()

sqlConnection.Close

End SubIf you do not include the namespace System.Data you must explicitly reference all classes contained in it, including CommandBehavior.