Can't Write To Database After Express SP2

Jan 9, 2008

I have a lot of databases under SQL Server Express 2005, reading an writing datas with VB6 (yes Visual Basic 6) and ADO (Provider SQLOLEDB). I do NOT install the SP2, but yesterday I install Silverlight and now I have SP2 on my SQL Server (9.0.3042) !?

Now I have a strange problem: I can read all datas, but I can't write any data to any tables.

Here a simple example:


I have a table "Professions", one column "RecNo" as int identity (1,1) with primary key and a column "Profession" as nvarchar(30).


Reading like this works:

Dim rcs As New Recordset

sTmp = "select * from Professions order by Profession"
rcs.Open sTmp, gcn, adOpenForwardOnly, adLockReadOnly
If rcs.RecordCount > 0 Then
Do
...
rcs.MoveNext
Loop Until rcs.EOF
End If
rcs.Close

Writing like this doesn't work anymore:

Dim lNewRecNo as long
Dim rcs As New Recordset

sTmp = "select * from Professions where RecNo = 42"
rcs.Open sTmp, gcn, adOpenKeyset, adLockOptimistic
If rcs.RecordCount < 1 Then rcs.AddNew
rcs!Profession = "XYZ"
rcs.Update
lNewRecNo = CNull2Val(rcs!RecNo)
rcs.Close


The rcs-object still give me the new record number after rcs.update, but the record is not in the database table. Adding a record in the Management Studio gives an error "row failed on retrieve on last operation". If I then click the button "Execute SQL" the new record is shown.
Another behaviour: Adding a row in the IDE like described above locks the Management Studio. From where I recieve a time out error then click the button "Execute SQL".
Any ideas whats wrong ?

View 1 Replies


ADVERTISEMENT

Sql Server Express Loses Ability To Write To Database

Jun 17, 2006

After a period of use (typically 1-2 hours), an application using SQL Server Express stops writing to the database, whilst still continuing to read from it. As far as I can tell, no error message is generated by any operation. The application is written in VB Express and is executed on several machines, with SQL Server Express on a central machine. Re-starting the application on the affected machine restores normal operation.

The problem on one machine does not cause a similar problem elsewhere at the same time (hence it appears to be an issue with the relationship between the application and SQL Server)

This does not appear to relate to the response to Q asked by sgcook on 9 may as we are not using user instances, but only a bare minimum connection string.

View 15 Replies View Related

SQL Server Express DB Write Permissions

Nov 23, 2006

Hi all Im currently going through a ASP.NET book but i just cant get to use the SQL server express databases that come with the code examples in the book. All i can do is read the data but thats about it. I keep on getting the error below whenever i try to alter the data in the databases. I have tried enabling write permissions for the NETWORK SERVICE account for the App_Data folder but i still get the same issue. Im running the web apps with these databases in IIS v5.1 and using Visual web developer express. Im still an ASP.NET novice so please keep the solution to my problem as simple as humanly possible.Thanks in advance all.
Matt
Server Error in '/Chapter06' Application.--------------------------------------------------------------------------------Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  Stack Trace: [SqlException (0x80131904): Failed to update database "C:INETPUBWWWROOTCHAPTER06APP_DATAWROXUNITED.MDF" because the database is read-only.]   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857338   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734950   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +401   System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +721   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78   System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +1152   System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +461   System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35   System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +163   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

View 2 Replies View Related

Sometimes Trouble With SQL Server Express (cannot Write Data)

Feb 9, 2007

Hi there, i have sometimes trouble to write data to a table in a sql server expr. database.

i have a vb.net application that writes every 2 minutes data to a table. sometimes (no regulary phenomen) the error appears after some hours, sometimes after some days. then i cannot write data in the table. it seems that the database sleeps or is offline.

before i write the data i check if the connection is open and i can write data.
if i cannot write the data i try several times and often after the third try i can write the data.

i have checked everything (no power save's on or other power off modes)

i have also test it with SqlClient.SqlConnection.ClearAllPools()

and many other things to find the bug, but no success at the moment.

it seems that the database or the table is away ?? or sleeps for some seconds ?!? i have no idea.

could you help me ?

Greetings Andreas



View 4 Replies View Related

How Should I Write Stored Procedure And Pass It Into Sql Server Express?

Feb 28, 2008

 Hi i m using vwd2005 express and sql express.1. I want to write stored procedure in sql express using sql server management studio express. I m not sure where to write and how to execute the stored procedure in sql server management studio express. Can any one explain the steps required to achieve this? 2.And what is the difference between creating database using:-       a. right click the project in solution explorer-> add new item->SQl database(creating .mdf file)and b.clicking a database explorer->data connection->Add connection ....       thanks.  jack.  

View 4 Replies View Related

Write Only Database

Jul 23, 2005

Hi,Is there a way to make a database write only, like in SQL server youcan make a DB read only? There is sensitive data which we want dontwant to read.What other alternatives can anyone think?Thanks.

View 4 Replies View Related

How To Write To Mssql Database

Oct 23, 2006

I am very new to asp.net. I really mainly use PHP but want to migrate to asp.net, but it doesn't seem that easy.I am creating a page for peson to pay a subscription page where they will enter personal information an credit card information.I created the form for this with validation controls.I don't know however how to write the form data to the mssql database.I am using mssql 2005, but i would need a work out for the 2000 version as well.

View 1 Replies View Related

Write All Transactions In The Log To The Database

Jun 26, 2000

Hi
All,
I would like to know write all transcations in the log file to the
database with out doing full backup of the database..
Please let me know is there any dbcc statement or some other method to do this..

Thanks A lot,
VJ

View 1 Replies View Related

ADO Write Not Commiting To Database

Sep 6, 2007

This seems about the best place for my query however it does cross over a bit ... dont shoot me.

SQL 2000 sp4 on server 2003
dev env VB6
users XP Sp2
Mdac 2.8

I have a legacy app that required some simple ammendment, insert a single row of data into a simple table (Not rocket Science) Sample : insert into maintcon_mach (maintcon_id, mach_id, date) values (123, 456, getdate())

PK on maintcon_id, mach_id so that single relationship exists between maintcon_id and mach_id in the table.

The procedure above is followed by a verification procedure that checks to see if table maintcon_mach has a mach_id 456 against maintcon_id 123, this procedure returns true. So far so good, however if you step through the procedure till disconnecting from the database and then reconnect and do only the verification again, the data is missing.

The following steps to resolve have resulted in no improvement.

1. Verify MDAC in entire project and on users computers all 2.8
2 Remove transactions (just in case) and still the same.
3 Replace SQL insert with ADO (As below) and still the same.. tried this with and without transactions.
4 Tried referecing older MDACs
5 Installed SQLredist on sample machines and still the same.


rs.Open "maintcon_mach", conMach, adOpenForwardOnly, adLockOptimistic
With rs
.AddNew
!maintcon_id = lngmaint
!mach_id = lngMachID
!Date = Format(Now(), "yyyy-mm-dd")
.Update
End With

Is the problem in SQL or MDAC???
Perhaps I've missed something (Obviously have) but have run out of places to look... Any idea's

In advance ...thanx

View 3 Replies View Related

Write Excel Data To MS SQL Database

Dec 22, 2003

Dear expert, please show me some examples of how I can update an Microsoft SQL table data with an excel sheet. Meaning, when I upload an excel sheet using an ASPX page the data in the excel sheet will be transfer to a particular table in the database. Thank you in advance.

View 2 Replies View Related

Write Data Into Database From A Session?

Oct 8, 2005

I'm trying to write data from a session into database but it won't work.
Could someone help me what is wrong with this.

cobjDT = Session("cart")
For each cobjDR in cobjDT.rows
 Dim cmdInsert2 as New SQLCommand("order_details", loConn)
             cmdInsert2.CommandType = CommandType.StoredProcedure
            
cmdInsert2.Parameters.Add(New SqlParameter("@Orders", SqlDbType.int, 4,
"OrderID"))
            
cmdInsert2.Parameters("@Orders").Value = Request("OrderIDtext")
            
cmdInsert2.Parameters.Add(New SqlParameter("@PID", SqlDbType.int, 4,
"PID"))
            
cmdInsert2.Parameters("@PID").Value = Request(cobjDR("PID"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@PakID", SqlDbType.int, 4,
"PakID"))
            
cmdInsert2.Parameters("@PakID").Value = Request(cobjDR("PAKID"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@StyckPris",
SqlDbType.decimal, 9, "StyckPris"))
            
cmdInsert2.Parameters("@StyckPris").Value = Request(cobjDR("StyckPris"))
            
cmdInsert2.Parameters.Add(New SqlParameter("@Mangd", SqlDbType.int, 4,
"Mangd"))
            
cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))
             loConn.Open()
             cmdInsert2.ExecuteNonQuery()
             loConn.Close()
next            

When I execute this an error message comes

Server Error in '/examen' Application.

Input string was not in a correct format.



Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:




Line 78: cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))Line 79: loConn.Open()Line 80: cmdInsert2.ExecuteNonQuery()Line 81: loConn.Close()Line 82: next







Source File: D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx    Line: 80


Stack Trace:




[FormatException: Input string was not in a correct format.] System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +194 ASP.TMP3thkwo1d0w_aspx.Page_Load(Object Sender, EventArgs E) in D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx:80 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731









Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

I use same character types in storedProcedure what they are in the
database and when I call the SP on my page the char types are same as
they are in the SP

I don't see what the problem is. Please Help

View 1 Replies View Related

Write In Database During DataReader Loop.

Mar 16, 2006

Hello,
I want to insert a value in a database table during a datareader loop. But I get an error saying that the connection (MyConnection) is already open. This is normal because it is open for processing the datareader loop. But how do I solve this? I just want to write a value for logging the process.
This is my code:
Dim iID as Integer = 1
Dim strSQLNewsLetter As String = "SELECT * FROM Members WHERE Members.Enabled=1"Dim MyCommand=New MySqlCommand(strSQLNewsLetter, MyConnection)MyConnection.Open()Dim myReader as MySQLDataReader myReader = MyCommand.ExecuteReader() While myReader.Read() If MyReader.GetMySqlDateTime(3).ToString() = "0/00/0000 0:00:00" then  WriteMyLog(iID, MyReader.GetInt32(0)) End IfEnd While myReader.Close()myConnection.Close()
Function WriteMyLog(iID as Integer, iMemberID as Integer) 'Write Log after Newsletter has been sent  Dim strSqlLog as String 'Create query  strSqlLog = "INSERT INTO NewsLetterStats (ID, MemberID, TimeSent) VALUES ("  strSqlLog &= "" & iID & "," 'NewsLetterID  strSqlLog &= "" & iMemberID & "," 'MemberID  strSqlLog &= "'" & MySQLTimeStamp() & "')" 'Timestamp   Dim MyCmdLogNews As New MySqlCommand(strSqlLog, myConnection)  MyCmdLogNews.Connection.Open()  MyCmdLogNews.ExecuteNonQuery()  MyCmdLogNews.Connection.Close()End Function

View 9 Replies View Related

How To Write Script To Update The Database?

Apr 30, 2004

Hi folks,
Do you guys know how to write the Script to update the SQL database? please help me out? For example, the script will update SQL database at 1:00 am every day...some like that?

Thanks,
Vu

View 4 Replies View Related

How To Write Query In Vwd2005 To Connect To Database?

Jan 31, 2008

can anyone help me here/i want to write connect to my sqldatabase and then perform insert query ,select query, update query from my default.aspx.cs file.but i dont know how to do this.can anyone explain me this in detail.?i want to my data in my webform in the sqldatabase, select it , and update it.how can i do this writing a code in c#.? plz explain in detail.i m using vwd2005 express and sql express.thanks.     

View 1 Replies View Related

Should I Add Lock Statements To My Database Write Querys

Jun 5, 2008

Hello,Could some clarify for me? I’ve been told that I should add  lock statements  to my database write querys (update, delete, insert). I’m not sure If it’s necessary though. The only documentation I’ve found so far is how to implement a lock statement with threading but I’m not using the threading namespace. What best practice and how would I implement this without threading or should I be using threading?Thanks in advance!
 

View 4 Replies View Related

How To Write Portable Database Access Code?

Jul 20, 2005

I can access Microsoft Access database via ODBC on Windows 2000 usingC++. Now, I would like to use the SAME piece of code to access MS SQLon Windows. Can I achieve this without any modification to my existingcodes?Then, I would like to use the SAME piece of codes to access Oracleon Windows? Is it possible?Thanks in advance!

View 1 Replies View Related

Transact SQL :: How To Write Query From Two Different Database Engines

Jul 13, 2015

Is it possible to write query from different database engines?

One database A is in local server database engine and another database B is in  another server located in different system.

Now , I need to write a query in database A  based on table A and table B (another database engine).

View 2 Replies View Related

Added A Column To My SQL Database And Now Text Field Will Not Write To It. Why???

Aug 28, 2006

I have a web form that is an interface for a database.  The code was working fine until a field needed to be added.  So I added the new field, updated the data adapter and data set, and when i enter the data into the field, all of the old fields are getting updated, but the new ones aren't.  I am at wits end as to why.  Can someone please help!!! I am using VS Studio 2000 ASP.NET and C#.  The code is below.  The bold items are the new fields.using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;namespace TrafficDept{/// <summary>/// Summary description for AddOwner./// </summary>public class AddOwner : System.Web.UI.Page{protected System.Web.UI.WebControls.Button Button1;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;protected System.Data.SqlClient.SqlConnection sqlConnection1;protected System.Web.UI.WebControls.TextBox TextBox1;protected System.Web.UI.WebControls.TextBox TextBox2;protected System.Data.SqlClient.SqlDataAdapter daAddOwner;protected System.Web.UI.WebControls.TextBox tbOtherOwnerLName;protected System.Web.UI.WebControls.Panel namePanel;protected System.Web.UI.WebControls.TextBox tbOtherOwnerMI;protected System.Web.UI.WebControls.TextBox tbOtherOwnerFName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerLName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerMI;protected System.Web.UI.WebControls.TextBox tbSecondOwnerFName;protected System.Web.UI.WebControls.Button Button4;protected SiteCubed.EditWorksProfessional tbNote;protected System.Web.UI.WebControls.Panel notePanel;protected System.Web.UI.WebControls.DropDownList ddlStatus;protected PeterBlum.PetersDatePackage.DateTextBox tbRegDate;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;protected System.Web.UI.WebControls.TextBox tbOwner;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;protected System.Web.UI.WebControls.TextBox tbOwnerMI;protected System.Web.UI.WebControls.TextBox tbOwnerLName;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;protected System.Web.UI.WebControls.TextBox tbBusinessName;protected System.Web.UI.WebControls.TextBox tbAddress;protected System.Web.UI.WebControls.TextBox tbRegNo;protected System.Web.UI.WebControls.TextBox tbPreviousOwner;protected System.Web.UI.WebControls.TextBox tbPOwnerAddress;protected System.Web.UI.WebControls.TextBox tbPORegNo;protected PeterBlum.PetersDatePackage.DateTextBox tbTransferDate;protected System.Web.UI.WebControls.DropDownList ddlMeans;protected System.Web.UI.WebControls.Button Button3;protected System.Web.UI.WebControls.Button Button2;protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;protected TrafficDept.dsAddOwner dsAddOwner1;  private void Page_Load(object sender, System.EventArgs e){// Put user code to initialize the page here}#region Web Form Designer generated codeprivate void Button2_Click(object sender, System.EventArgs e){Response.Redirect("AddOthers.aspx");}private void Button1_Click(object sender, System.EventArgs e){daAddOwner.Fill(dsAddOwner1);dsAddOwner.OwnershipRow drOwner = dsAddOwner1.Ownership.NewOwnershipRow();drOwner.Plates_ID = int.Parse(Session["PlatesID"].ToString());drOwner.Status = ddlStatus.SelectedItem.Text;drOwner.Current_Legal_Owner = tbOwner.Text;drOwner.Owner_CurrentLegalOwnerMI = tbOwnerMI.Text.ToString();drOwner.Owner_CurrentLegalOwnerLName = tbOwnerLName.Text;drOwner.Owner_CurrentBusinessName = tbBusinessName.Text;if (!tbRegDate.xIsEmpty)drOwner.Date_of_Registration = DateTime.Parse(tbRegDate.Text.ToString());drOwner.Address_of_Current_Owner = tbAddress.Text;drOwner.Reg_No_for_Current_Owner = tbRegNo.Text;drOwner.Previous_Owner = tbPreviousOwner.Text;drOwner.Previous_Owner_Address = tbPOwnerAddress.Text;drOwner.Reg_No_for_Previous_Owner = tbPORegNo.Text;if (!tbTransferDate.xIsEmpty)drOwner.Date_of_Transfer = DateTime.Parse(tbTransferDate.Text.ToString());drOwner.By_Means_of = ddlMeans.SelectedItem.Text;drOwner.Owner_SecondaryLegalOwnerFName = tbSecondOwnerFName.Text;drOwner.Owner_SecondaryLegalOwnerMI = tbSecondOwnerMI.Text;drOwner.Owner_SecondaryLegalOwnerLName = tbSecondOwnerLName.Text;drOwner.Owner_OtherLegalOwnerFName = tbOtherOwnerFName.Text;drOwner.Owner_OtherLegalOwnerMI = tbOtherOwnerMI.Text;drOwner.Owner_OtherLegalOwnerLName = tbOtherOwnerLName.Text;drOwner.Owner_Notes = tbNote.Text;dsAddOwner1.Ownership.Rows.Add(drOwner);daAddOwner.Update(dsAddOwner1);Response.Redirect("AddOthersTP.aspx");}private void Button3_Click(object sender, System.EventArgs e){//daAddOwner.Fill(dsAddOwner1);//dsAddOwner.OwnershipRow drAddOwner = dsAddOwner1.Ownership.NewOwnershipRow();namePanel.Visible = true; }private void Button4_Click(object sender, System.EventArgs e){notePanel.Visible = true;}}}

View 1 Replies View Related

How To Write Database Scripts Using Sql Server Managment Studio

Apr 25, 2008

Hello All,
My boss told me that we can write migration scripts to database using Sql server management studio. can someone guide me or point to a website which explains in detail how to do this please. i want to learn this. or even a tutorial also would be great. i am interested in writing or executing scripts by using sql server management studio( in sql server 2005). i think its called sql enterprise manager in sql server 2000.
Thanks a lot.

View 5 Replies View Related

Application Locks Up When Trying To Write To Db After A Replication Where I Create The Database.

Jan 3, 2008

Hello all,

When I create a new database and replicate to it using BeginMonitoredBackgroundSync :







Code Block

public void BeginMonitoredBackgroundSync(string User)
{
CreateReplicationInstance(User);
repl.BeginSynchronize(
OnSimplifiedSynchronizeComplete,
SqlCeReplication_OnStartTableUpload,
SqlCeReplication_OnStartTableDownload,
SqlCeReplication_OnSynchronization,
repl);
}




private void CreateReplicationInstance(string User)
{
repl = new SqlCeReplication();
string host = repl.HostName;
repl.HostName = User;
string dbFilePath = "";


dbFilePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
"\" + repl.HostName + ".sdf";
string myConnectionString = string.Format("Data Source = {0};PWD = {1}", dbFilePath, sqlSettings.Items["SqlPassword"]);

repl.InternetUrl = dynamicsReplicationSettings.ReplicationSettingsItems["InternetUrl"];
repl.PublisherSecurityMode = SecurityType.DBAuthentication;
repl.Publisher = dynamicsReplicationSettings.ReplicationSettingsItems["Publisher"];
repl.PublisherDatabase = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherDatabase"];
repl.PublisherLogin = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherLogin"];
repl.PublisherPassword = dynamicsReplicationSettings.ReplicationSettingsItems["PublisherPassword"];
repl.Publication = dynamicsReplicationSettings.ReplicationSettingsItems["Publication"];

repl.Subscriber = "RemoteSubscription" + repl.HostName;
repl.SubscriberConnectionString = myConnectionString;

repl.ConnectionRetryTimeout = 120;
repl.LoginTimeout = 120;
repl.CompressionLevel = 6;

if (File.Exists(dbFilePath))
{
FileInfo info = new FileInfo(dbFilePath);
if (info.Length <= 20480)
{
File.Delete(dbFilePath);
repl.AddSubscription(System.Data.SqlServerCe.AddOption.CreateDatabase);
}
}
else
{
repl.AddSubscription(System.Data.SqlServerCe.AddOption.CreateDatabase);
}

primeConnection();

}
After the replication finishes, I dispose the replication object like so:





Code Block

void OnAsyncSynchronizeComplete(IAsyncResult asyncResult)
{

try
{
repl.EndSynchronize(asyncResult);
if (repl != null)
{
repl.Dispose();
repl = null;

}
if (ReplicationComplete != null) ReplicationComplete(this, true);
}
catch(Exception ex)
{
if (ReplicationComplete != null) ReplicationComplete(ex, false);
}

}

Then later, if I try to update, insert or delete to the database, the application will hang. I can read from it, but I cannot write. If I close the application down and open it back up without replicating, I will not get any lockups. It also will not hang up after any replications prior to the create replication. I think I am doing something wrong in the initial replication that is holding on to some connection to the DB causing it to lock up. Has anyone seen anything like this before?

View 1 Replies View Related

Way To Determine Which Logins Have Write Permissions To Database On Sever

Nov 15, 2007

Hi there,

Does anyone know a way (a query perhaps?) to determine which logins have write permissions to a specific database on SQL Server 2005? Ive thought about joining sys.syslogins & sys.sysusers but looking at the columns, not sure which one would render me that info.

Any help is appreciated. Many thanks!

View 1 Replies View Related

HELP To Write Stored Procedure Whose Values Are Calculated Automatically In Database

May 12, 2007

 Hi frdz,    I m creating my web-application in asp.net with C# 2005 and using sql server 2005.    I have created the stored procedure for the insert,update.    I want to know how to write the mathematical calculations in the stored procedure..    Pls tell me from the below  stored procedure  were i m making the mistake  ??    As the discount and the total amount are not calculated by itself....and stored in the database   How to convert the @discpercent numeric(5,2) to@discpercent ="NoDiscount" should be displayed when no discount is being given to the customers....     ALTER PROCEDURE CalculationStoredProcedure

@accountid int output,
@accountname varchar(20),
@opbal numeric(10, 2),
@opbalcode char(2),
@total numeric(10, 2),
@clbal numeric(10, 2),
@clbalcode char(2),
@discpercent numeric(5,2),
@discamt numeric(10, 2)


as


begin
set nocount on



if @opbal IS NULL OR @opbal = 0

begin
select @opbal=0
select @opbalcode= ' '
select @clbal= 0
select @total= 0
select @clbalcode= ' '
@discpercent ="NoDiscount"
@discamt=0
end




select @accountid = isnull(max(accountid),0) + 1 from accountmaster



select @total=@opbal - @clbal from accountmaster
select @discamt=@total* @discpercent/100 from accountmaster

begin
insert into accountmaster
(
accountname,opbal,opbalcode,clbal,clbalcode

)
values
(
@accountname,@opbal,@opbalcode,@clbal,@clbalcode
)

end

set nocount off
end

      Thanxs in adv... 

View 7 Replies View Related

SQL Server 2012 :: Determine Read / Write Frequency On Database Table

Oct 6, 2015

How do I determine the read/write frequency on a database table? I am trying to do this on a 2012 and 2008 R2 servers.

View 2 Replies View Related

SQL Server Management Studio Express, Database Explorer In Visual Web Developer Express...which To Use???

Apr 16, 2007

When I downloaded/started using Visual Web Developer I was under the impression that I needed to install SQL Server Management Studio Express in order to create/manage databases, and to provide the engine to access the data.
 Since then I have found tutorials and have successfully created/used databases solely from within Visual Web Developer. I'm assuming that Visual Web Developer includes a database engine, much like the webserver that is included. (This is an awesome thing).
 When I tried to upload my web application with database to my production server, the database would not work, it started working after I installed SQL Server Management Studio Express on the server.
 Is it my understanding that you need SQL Server Management Studio Express if you do not have Visual Web Developer Express installed in order to provide the data access engine?
Also, I am unable to "attach" my Visual Web Developer Express created database to SQL Server Management Studio Express. Are there any posts that provide more information about this topic?
 
The only reason I'm asking is that I have extra whitespace on the end of my text fields, and I thought ANSI_PADDING was turned on. I do not see the option in Visual Web Developer Express, but have found it in SQL Server Management Studio Express.

View 14 Replies View Related

Database Connection: Mapped Network Drive (VC++ Express, MSSQL SMS Express, XP)

Sep 8, 2007


Hi


I have VC++ express and MSSQL SMS express and have an application working nicely locally. The Data explorer and data connections part works really easily.

Now, I want to make the application available to my home network.

I mapped the drive where the database is and called it Z: so I could put my "release" on my other network PC and assumed it would find Z: if I mapped the shared network drive on that machine and called it Z:

But: I can't even add the mapped connection on the local machine, I get:

The file "Z:databasescalorie.mdf" is on a network path not supported for database files. An attempt to attach.....etc"

It works fine on the original F drive.......

Am I approaching this the wrong way. How should I distribute to network PCs?

thanks hopefully
David

View 5 Replies View Related

Import Existing Database Into SQL SERVER EXPRESS Management Studio Express

Feb 18, 2008



Hi,

I am a newbie so i apologies beforehand for any mistakes i make on this forum.
Anyway, i created an asp.net website using the MS Visual Web developer tool. This has a couple of SQL SERVER databases within it.
I then latervinstalled the SQL SERVER management studio express in order to manage the SQL SERVER DBs that i had as part of my website but they do not appear within the management studio db list.
As this is the express version, is there anyway of importing the existing SQL SERVER dbs that i have to the management studio so i can manage them from there?

Regards,

Shuja.

View 5 Replies View Related

Error Creating First SQL Express Database Via VWD 2005 Express: User Does Not Have Permission To Perform This Action

Aug 18, 2006

I get an error dialog when I try to create a new SQL database, both via the Add New Item dialog and the property wizard of a new SqlDataSource control. The error is:


Local Database File:

User does not have permission to perform this action.

I've searched for help with this.

I ensured the App_Data folder exists and I added the local ASP.NET account to the group that have R/W access to it (although the RO flag is in an unchangeable tri-state on the folder).
The SQL Server Express error log is clean and indicates full functionality.
Everything is running locally.
No VWD installation errors.

Any ideas?

Thank you!

View 3 Replies View Related

Problem Connecting To Sql Express Database From Visual Web Developer Express

Apr 7, 2006

Here is the error message I get:http://img109.imageshack.us/my.php?image=error2ug.jpgI have just installed both packages and havent done much in the way of configuration...  What do i need to do?  Thanks!

View 2 Replies View Related

Deploying Multi-user Sql Express Database To SQL Express Server

Jul 10, 2007



Okay, I've read massive topics on ClickOnce, and embedded database applications, etc, etc.



I need a handful of good suggestions how I can create a deployment package, to get my sql express database onto a SQL Express server.



The database will need to be multi-user, because I am also developing a WinForms application to connect to the SQL Express database.



I'm thinking I need to use some automated scripting features, to generate scripts for the database once I am done (unless you have a better suggestion).



After that, I need to know what to do with those scripts, and how can I create a setup / deployment packages to run those scripts against a SQL Express server.



The other alterntative obviously is to copy my sql express database, and run an attach command. This will work the first time, only because this will have been the first deployment of this database.



Please keep in mind when answering this question, that I will not be embedding the database, and as far as I understand ClickOnce is a feature for use with embedded databases or user instance databases (not sure).



Daniel Crane

View 6 Replies View Related

Why Can't I See My Web Developer Express Database From SQL Server Management Studio Express?

Apr 30, 2006

Hi, I'm completely new to SQL Server and ASP.NET, so please bear with me on my learning curve! I've installed Visual Web Developer Express and SQL Server Express (on the same PC). I then used Web Developer Express to successfully create a new database with a couple of tables in it. So far so good. I then installed SQL Server Management Studio Express on the same PC and tried to connect to my new database. The connection to the SQL Server instance appears to work OK (using Windows Authentication) but I can't see the database I previously created. All I can see are the System Databases. Does anyone know what the solution might be?

View 4 Replies View Related

Concurrency Issue On A Single Database User For An Online Read/write Application

Aug 3, 2006

Hi to all DBAs,

I would like to ask if there will be a write and concurrency issue if i would create an online application with just one user connecting to the database, just like most open source php/mysql that can be downloaded

i.e
Setup 1. I will grant a single user that will connect to a database and will be set to a config.inc.php file and then create a table users (userid, username, password) and this table will be used for the application authentication and access control.

Setup 2. or is it much better to grant users that will connect to the database and have the table users for access control of the application?

to further illustrate my query:

Setup 1 would be:
###################Table: Users
user a@ipadd --> db1 --> userid mary --> myOnlineApp
user a@ipadd --> db1 --> userid john --> myOnlineApp
user a@ipadd --> db1 --> userid paul --> myOnlineApp


and Setup 2 would be:
#####################Table: Users
user mary@ipadd --> db1 --> userid mary --> myOnlineApp
user john@ipadd --> db1 --> userid john --> myOnlineApp
user paul@ipadd --> db1 --> userid paul --> myOnlineApp

will Setup 1 be enough if I will use SQL Server as database?

or Setup 2 is better user/database architecture?

This application will be online enrollment for a school with 16,000 students

very much appreciated for the feedbacks and suggestions

^_^x

View 3 Replies View Related

SQL 2012 :: Blank Database Created On Two Separate Disks - Write To Multiple Files

Mar 17, 2014

I am testing out a blank database created over two physical files on two separate disks with one table called data which has one column called values nvarchar(max).

I filled the table up with a whole load of data and ran a select * against it. If I run Permon at the same time I can see that the read load has been spread over multiple disks as each of these disks is getting read from in parallel. If I create the same database on a single file and run the same select * again it takes much longer, proving that the read load has been distributed across multiple disks.

Now moving onto writes, this is where the confusion lies. I understand that SQL server fills files evenly until they need growing, after which it will then fill files individually until they are full in a round robin fashion unless you have trace 1117 turned on. What I don't understand is why the writes aren't distributed out whilst it is filling these file groups.

I ran an continual insert into my table with go 1000000 to monitor how the files are being filled up. I monitored where SQL server was physically placing the files as they were being inserted by running the following query:

;WITH CTE AS
(SELECT
sys.fn_PhysLocFormatter (%%physloc%%) col1,
RIGHT(LEFT(sys.fn_PhysLocFormatter (%%physloc%%),2),1) AS [Physical RID],
DATAID

[Code] ....

I could see that it would a thousand or so records into file 1, then a thousand or so into file 2, then a thousand or so into file 1 etc etc. In another words it would hit one disk, then another disk, then back to disk one to fill the file evenly. Is there any way to make SQL Server distribute the writes out in parallel so that both disks are writing in tandem?

By the looks of it, multiple disks only scale reads, as with writes only one disk is ever written to at once which is annoying. Any way to harness the write power of multiple disks?

View 6 Replies View Related

Northwind Database In SQL Server Management Studio Express Is Lost Or Used/processed By VB 2005 Express:How To Locate/return It

Dec 3, 2007

Hi all,

In the last one and half years, I used the Northwind Database in SQL Server Management Studio Express (SSMSE) to learn the programming of SqlConnections, Data sources, Database Exploere, ADO.NET 2.0, etc. via VB 2005 Express.

The Northwind Database in my SSMSE got lost very often, but I was not aware of it. How can I know where the Northwind Database is used or processed by my VB 2005 Express projects that were the examples of some tutorial books or my trial projects? How can I release the Northwind Database back to my SSMSE from the VB 2005 Express projects? Please help and advise.

Thanks in advance,
Scott Chang

View 2 Replies View Related







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