Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Friday, March 23, 2012

Little bit confused about databases on CE

Hi there,

i need a database for my Windows CE application which i can update from a desktop application.

I tried the SqlCeConnection. This works good on the device, but i found out, that i need a sql server on the desktop or someone else to get access to the device server. This is a problem for me, because i cannot insall such a sever on the desktop.

So i searched and searched....I found infos about the ole connection, but i cant find the namespace?!?

Can anyone give me a hint what the best solution could be?

Im using Visual Studio 2005 and a CE device.

Thanks a lot

You can use VS 2005 'Add New Datasource Wizard' under Data menu OR in Server Explorer ==> Add Connection to update the database on device. Also, with introduction of SQL Server Compact/Mobile/Everywhere Edition, you can copy the database file to a desktop and you can use System.Data.SqlServerCe.dll that is installed on desktop (If not installed, download and install this http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=898913&SiteID=1).

Thanks,

Laxmi

Wednesday, March 21, 2012

Listening for report events

I have a series of reports and want to fire off a stored procedure to update
a "Printed date" column in my database. I don't want to do this from the
dataset that populates my datset as I only want this to occur if the report
is successfully generated. Is there any way I can do this with the scheduler?
If not, are the any report events that I can listen for? And or any other
solution to this problem.Sorry. I don't think I made my intentions very clear. I meant to say that I
have a series of report, and want to fire off a stored procedure everytime a
report is successfully generated.
"Graham Hope" wrote:
> I have a series of reports and want to fire off a stored procedure to update
> a "Printed date" column in my database. I don't want to do this from the
> dataset that populates my datset as I only want this to occur if the report
> is successfully generated. Is there any way I can do this with the scheduler?
> If not, are the any report events that I can listen for? And or any other
> solution to this problem.

Monday, March 12, 2012

list of strings passed into a parameter

I am trying to pass multiple values as parameters into my update command:

UPDATE tblUserDetails SET DeploymentNameID = 102 WHERE ((EmployeeNumber IN (@.selectedusersparam)));

I develop my parameter (@.selectedusersparam) using the following subroutine:

PrivateSub btnAddUsersToDeployment_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles btnAddUsersToDeployment.Click

Dim iValAsInteger = 0

Dim SelectedCollectionAsString

SelectedCollection =""

If (lsbUsersAvail.Items).Count > 1Then

For iVal = 0To lsbUsersAvail.Items.Count - 1

If lsbUsersAvail.Items(iVal).Selected =TrueThen

SelectedCollection = SelectedCollection &"," & lsbUsersAvail.Items(iVal).Value

EndIf

Next

SelectedCollection = Mid(SelectedCollection, 2, Len(SelectedCollection))

Session.Item("SelectedCollectionSession") = SelectedCollection

SqlDataSource4.Update()

ltlUsersMessage.Text =String.Empty

'UPDATE tblUserDetails SET DeploymentNameID = @.DeploymentNameIDparam WHERE (EmployeeNumber IN (@.selectedusersparam))

'SqlDataSource4.UpdateCommand = "UPDATE tblUserDetails SET DeploymentNameID = @.DeploymentNameIDparam WHERE (EmployeeNumber IN (" + SelectedCollection + ")"

Else

ltlUsersMessage.Text ="Select users before adding to deployment. Hold Control for multiselect"

EndIf

EndSub

For some reason the query does not pass the parameters which are "21077679,22648722,22652940,21080617" into the query

I don't understand why.

hi,

could you debug your application, i want to know what actual query is being passed. you've for loop for some list, while debugging does it go inside this loop or not.

also if i am not wrong you've commented out following line

'SqlDataSource4.UpdateCommand = "UPDATE tblUserDetails SET DeploymentNameID = @.DeploymentNameIDparam WHERE (EmployeeNumber IN (" + SelectedCollection + ")".

seems like it is the cause as i dont see other line for setting updatecommand.

please check & let me know.

regards,

satish

|||

This works but does not use parameters:

ProtectedSub btnRemoveUsersFromDeployment_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles btnRemoveUsersFromDeployment.Click

Dim iVal2AsInteger = 0

Dim SelectedCollection2AsString

SelectedCollection2 =""

If (lstUsersToRemoveFromDeployment.Items).Count > 0Then

For iVal2 = 0To lstUsersToRemoveFromDeployment.Items.Count - 1

If lstUsersToRemoveFromDeployment.Items(iVal2).Selected =TrueThen

SelectedCollection2 = SelectedCollection2 &"," & lstUsersToRemoveFromDeployment.Items(iVal2).Value

EndIf

Next

SelectedCollection2 = Mid(SelectedCollection2, 2, Len(SelectedCollection2))

Session.Item("SelectedCollectionSession") = SelectedCollection2

SqlDataSourceInCurrentDeployment.UpdateCommand ="UPDATE tblUserDetails SET DeploymentNameID = null WHERE ((EmployeeNumber IN (" + SelectedCollection2 +")))"

SqlDataSourceInCurrentDeployment.Update()

Else

MsgBox("Please select user(s) first")

EndIf

EndSub

|||

hi,

i am not clear mate...in earlier post you were passing parameter for DeploymentNameID in update command now you've removed and used null!!!

i m confusedEmbarrassed, what is actual problem.

regards,

satish.

|||

I have used the same concept for two different situations.

In the last post I did I was removing the Deployment name ID created by the first update command.

cheers.

Ben.