Showing posts with label click. Show all posts
Showing posts with label click. Show all posts

Sunday, March 11, 2012

2nd INSERT INTO statement in a Button click event

Hi everyone.
I am trying to write 2 INSERT INTO statements into a Button click event. Both statements go to the same database but differnet tables. The first statement works fine but the 2nd causes an error with the Try, Catch, Finally statement. When I remove the ExecuteNonQuery from the 2nd statement, the 2nd INSERT INTO statement fails to work. Any help would be brilliant. Thanks!

Private Sub btnInsertChange_Click(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles btnInsertChange.Command

'Insert Guide changes into ChangesReport table in sql server
Me.SqlCommandThemeTest.Connection = Me.SqlConnection1

Dim Name As String
Dim values As String
Dim sSQL As String
Name = "Theme, Guide, GuidePage, PageType, ChangeCategory, ChangeFrom, ChangeFromText, ChangeTo, ChangeToText ContentManager"
values = "lstTheme, lstGuideName, lstGuidePage, lstPageType, lstChangeCategory, lstChangeFrom, txtChangeFrom, lstChangeTo, txtChangeTo, Label1"
SqlCommandThemeTest.CommandText = "INSERT INTO dbo.ChangesReport (Theme, Guide, GuidePage, PageType, ChangeCategory, ChangeFrom, ChangeFromText, ChangeTo, ChangeToText, ContentManager) VALUES (@.themeValue, @.guideValue, @.guidepageValue, @.pagetypeValue, @.changecategoryValue, @.changefromValue, @.changefromtextValue, @.changetoValue, @.changetotextValue, @.contentmanagerValue)"

SqlCommandThemeTest.Parameters.Add("@.themeValue", lstTheme.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.guideValue", lstGuideName.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.guidepageValue", lstGuidePage.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.pagetypeValue", lstPageType.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.changecategoryValue", lstChangeCategory.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.changefromValue", lstChangeFrom.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.changefromtextValue", txtChangeFrom.Text)
SqlCommandThemeTest.Parameters.Add("@.changetoValue", lstChangeTo.SelectedItem.Text)
SqlCommandThemeTest.Parameters.Add("@.changetotextValue", txtChangeTo.Text)
SqlCommandThemeTest.Parameters.Add("@.contentmanagerValue", Label1.Text)

Try
Me.SqlConnection1.Open()
Me.SqlCommandThemeTest.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.ToString)
Finally
Me.SqlConnection1.Close()
End Try


'Insert textbox to ChangeLogFrom ddl
Me.CmdDDLFromUpdate.Connection = Me.SqlConnection1

Name = "ChangeFromText"
values = "txtChangeFrom"
sSQL = "INSERT INTO dbo.Change Log From (ChangeLogFrom) VALUES (@.changelogfromValue)"
Me.CmdDDLFromUpdate.Parameters.Add("@.changelogfromValue", txtChangeFrom.Text)

Try
Me.SqlConnection1.Open()
Me.CmdDDLFromUpdate.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.ToString)
Finally
Me.SqlConnection1.Close()
End Try

I have tried various different things with these 2 statements but can still only get the first to insert.

Any advice would be great. Thanks

|||

It's hard to tell since you've only cut and pasted certain parts of the code. For example, I don't see where you've set the commandtext of the second sqlcommand. I see the sSQL string being set, but that isn't the same thing.

You might also want the keep the sqlconnection open for both updates, no use in closing it then reopening it.

|||Why dont you pass all the parameters to a stored proc and do both the inserts there. That will save you a round trip and your code will be at one place.

Tuesday, March 6, 2012

2005: Publishing (not exporting) Report in Excel format

My end users want me to post 2 versions of my 2005 Reporting Services
reports. One that when they click on it automatically opens in Excel w/o
grouping...sort of a data dump. Then a second that is grouped, formatted and
pretty.
I know that I can have them export the report once run into Excel, but they
don't want that. (of course...;) So, does anyone know how to publish in
straight Excel in Reporting Services?
thanks in advance for any help!
MachelleYou didn't say if you are using Report Manager or not. The best way is to
use jump to URL and render in CSV ASCII format. The default for CSV is
unicode which Excel opens up with all the data in its own column.
Depending on your report you may or may not want to have a duplicate report
that you have cleaned up and call that one rather than the pretty one.
Regardless, if you have any data size at all URL is much faster.
If you are using Report Manager you could have a report that has no data,
just the parameters and then textboxes, one for pretty, one for Data Export
(I call it that in my link to differentiate that it is a data export, not
the pretty Excel export).
Note, the fields texboxes of the report have a name property that is set
during design to the name of the field. You can give it friendlier names if
you want.
Here is an example of a Jump to URL link I use. This causes Excel to come up
with the data in a separate window:
="javascript:void(window.open('" & Globals!ReportServerUrl &
"?/SomeFolder/SomeReport&ParamName=" & Parameters!ParamName.Value &
"&rs:Format=CSV&rc:Encoding=ASCII','_blank'))"
Very nice and very fast.
Bruce Loehle-Conger
"Machelle" <Machelle@.discussions.microsoft.com> wrote in message
news:A5360BDE-440C-4AAF-8D07-46A9D3472567@.microsoft.com...
> My end users want me to post 2 versions of my 2005 Reporting Services
> reports. One that when they click on it automatically opens in Excel w/o
> grouping...sort of a data dump. Then a second that is grouped, formatted
> and
> pretty.
> I know that I can have them export the report once run into Excel, but
> they
> don't want that. (of course...;) So, does anyone know how to publish in
> straight Excel in Reporting Services?
> thanks in advance for any help!
> Machelle

Sunday, February 19, 2012

2005 Replication Mon Interface

I am playing around with the new Replication Monitor in 2005. In the old
Replication Monitor (SQL Sever2k), you could right click on a subscription
and Start or Stop Synchronizing. So far I have not been able to find this
feature in the new Replication Monitor and I've had to SQL Server Management
Studio to be able to control the subscription. Our subscriptions frequently
go off-line (off-site) and sometimes require a manual start when they
return, so access to this feature for all subscriptions in one place is
handy.
Thanks for any help.
Ted.
The button you are looking for is called "Start Synchronizing" with the
corrollary of "Stop Synchronizing". I can't remember exactly where it is,
but it is located somewhere around the actual subscription.
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"TCorp" <tcorpus@.hotmail.com> wrote in message
news:OtxxSZMEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>I am playing around with the new Replication Monitor in 2005. In the old
>Replication Monitor (SQL Sever2k), you could right click on a subscription
>and Start or Stop Synchronizing. So far I have not been able to find this
>feature in the new Replication Monitor and I've had to SQL Server
>Management Studio to be able to control the subscription. Our
>subscriptions frequently go off-line (off-site) and sometimes require a
>manual start when they return, so access to this feature for all
>subscriptions in one place is handy.
> Thanks for any help.
> Ted.
>
|||Connect to your Publisher in WorkBench, expand the Replication node, expand
Local Publications, right click on your publication and select Launch
Replication Monitor (I think you are already here). Expand the Replication
Monitor Node, My Publishers node, and your Publisher node, and locate your
publication. Click on it and then in the Right Hand pane, select Warnings
and Agents tab. In the lower portion of the pane locate your snapshot agent
and right click on it to start it or stop it.
You can also access it through the SQL Server Agent node in SQL WorkBench
for your SQL Server, and expand the Jobs folder. Right click on your Agent
(if you can locate it by its name) and select Start Job or Stop Job.
I think at this point it is important to point out that the Replication
Wizards and interfaces were completely redesigned to make them more
intuitive and less confusing.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"TCorp" <tcorpus@.hotmail.com> wrote in message
news:OtxxSZMEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>I am playing around with the new Replication Monitor in 2005. In the old
>Replication Monitor (SQL Sever2k), you could right click on a subscription
>and Start or Stop Synchronizing. So far I have not been able to find this
>feature in the new Replication Monitor and I've had to SQL Server
>Management Studio to be able to control the subscription. Our
>subscriptions frequently go off-line (off-site) and sometimes require a
>manual start when they return, so access to this feature for all
>subscriptions in one place is handy.
> Thanks for any help.
> Ted.
>
|||Translated, it will take you a while to figure out where they put
everything.
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:OwvBUtMEGHA.344@.TK2MSFTNGP11.phx.gbl...
> Connect to your Publisher in WorkBench, expand the Replication node,
> expand Local Publications, right click on your publication and select
> Launch Replication Monitor (I think you are already here). Expand the
> Replication Monitor Node, My Publishers node, and your Publisher node, and
> locate your publication. Click on it and then in the Right Hand pane,
> select Warnings and Agents tab. In the lower portion of the pane locate
> your snapshot agent and right click on it to start it or stop it.
> You can also access it through the SQL Server Agent node in SQL WorkBench
> for your SQL Server, and expand the Jobs folder. Right click on your Agent
> (if you can locate it by its name) and select Start Job or Stop Job.
> I think at this point it is important to point out that the Replication
> Wizards and interfaces were completely redesigned to make them more
> intuitive and less confusing.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "TCorp" <tcorpus@.hotmail.com> wrote in message
> news:OtxxSZMEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>
|||This article should help clarify things a bit:
http://www.replicationanswers.com/GUIArticle.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks everyone for your help and prompt replies.
But what I am looking for is to stop and start my (pull) Merge Agents.
Looking at Paul Ibison's helpful article, I realize that the option to Start
and Stop the merge agents is not there (in the All Subscriptions Tab of my
publication). The only options when I right-click the subscription are:
- View Details
- Reinitialize Subscription
- Validate Subscription
- Agent Profile
- Properties
- Refresh
Currently, the only way I can Start/Stop the merge agents is to connect to
the [subscription] server in Management Studio, open the
"Replication-->Local Subscriptions" folder, right-click the subscription and
select "View Synchronization Status". That dialog box give me buttons to
Start and Stop the agent.
Strangely, I thought I created a publication last week (in my testing) that
had that option there, and that's part of the reason I am so confused right
now, as it seems to have disappeared.
My publisher/distributor is SQL Server 2005 and my pull merge subscriptions
are running on MSDE.
Thanks again.
------
"TCorp" <tcorpus@.hotmail.com> wrote in message
news:OtxxSZMEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>I am playing around with the new Replication Monitor in 2005. In the old
>Replication Monitor (SQL Sever2k), you could right click on a subscription
>and Start or Stop Synchronizing. So far I have not been able to find this
>feature in the new Replication Monitor and I've had to SQL Server
>Management Studio to be able to control the subscription. Our
>subscriptions frequently go off-line (off-site) and sometimes require a
>manual start when they return, so access to this feature for all
>subscriptions in one place is handy.
> Thanks for any help.
> Ted.
>
|||Now that I know where the option to synchronize really was (Thanks Paul) and
that it was missing, I was able to look further into it.
It seems that it is a difference between push and pull merge agents. The
option to Start/Stop synchronizing the Merge agents seems to only be
available for PUSH subscriptions in the Replication monitor. These articles
implicate such:
http://msdn2.microsoft.com/en-us/library/ms152749.aspx
http://msdn2.microsoft.com/en-us/library/ms151261.aspx
We've historically used Pull subscriptions because our MSDE subscribers were
often off-line and we were experiencing a lot of error messages in the
replication monitor. But now I must reconsider using push again.
My only recourse now to to ask if anyone knows why the 2005 Replication
Monitor does not allow us to Start/Stop pull subscriptions.
Thanks, Ted.
"TCorp" <tcorpus@.hotmail.com> wrote in message
news:OxOc%23ZVEGHA.1120@.TK2MSFTNGP11.phx.gbl...
> Thanks everyone for your help and prompt replies.
> But what I am looking for is to stop and start my (pull) Merge Agents.
> Looking at Paul Ibison's helpful article, I realize that the option to
> Start and Stop the merge agents is not there (in the All Subscriptions Tab
> of my publication). The only options when I right-click the subscription
> are:
> - View Details
> - Reinitialize Subscription
> - Validate Subscription
> - Agent Profile
> - Properties
> - Refresh
> Currently, the only way I can Start/Stop the merge agents is to connect to
> the [subscription] server in Management Studio, open the
> "Replication-->Local Subscriptions" folder, right-click the subscription
> and select "View Synchronization Status". That dialog box give me buttons
> to Start and Stop the agent.
> Strangely, I thought I created a publication last week (in my testing)
> that had that option there, and that's part of the reason I am so confused
> right now, as it seems to have disappeared.
> My publisher/distributor is SQL Server 2005 and my pull merge
> subscriptions are running on MSDE.
> Thanks again.
> ------
> "TCorp" <tcorpus@.hotmail.com> wrote in message
> news:OtxxSZMEGHA.2300@.TK2MSFTNGP15.phx.gbl...
>

Saturday, February 11, 2012

2005 BoL

Hi

Why is it when I search BoL or click on links on the index I keep getting SQL Server Mobile help pages rather than (for example) the Transact SQL help pages that I want. I can usually find a link at the bottom of the page but is there any way to filter this stuff out in the first place?

Ta!where are you searching? google? msdn? or BOL on your own computer?|||BoL on my pc|||For example - ALTER TABLE in the index - I get a link that, when clicked, takes me to ALTER TABLE (SQL Server Mobile). Down the bottom there is a link to ALTER TABLE (Transact SQL). I want that one first :)|||Ok - filter by database engine rather than SQL Server 2005 and I don't appear to get the mobile stuff. Not sure what else I might lose too though...|||maybe this will help:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=647689&SiteID=1|||Jezemine - thank you. Another concise and accurate post :)

Out of curiosity, did you know about that already or (to my shame) did you just google because I did not find that one... :o

Anyway - will try in work tomoz.|||i had a vague recollection of seeing the post, but I didn't have the link memorized. ;)

so I resorted to google.

fyi, here's the search I did: http://www.google.com/search?q=remove+mobile+from+bol|||fyi, here's the search I did: http://www.google.com/search?q=remove+mobile+from+bolOh....





Dear :o

N00bie Poots|||see what you get for http://www.google.com/search?q=turn+off+activex and http://www.google.com/search?q=turn+off+javascript

;)|||Forgive my ignorance - what is the relationship?|||nothing, it's just that i happened to somehow end up as #1 or #2 on the search results for both those queries, when you'd think a microsoft page might come up ahead of me

or maybe not

sorry for the dissonance|||Lol - I read the culminated-in-the-SQL-Consultant-moniker article some time ago.
Are you just showing off?

Anyway - ActiveX settings checked and they are OFF OFF OFF :D

BTW - familiar with cognitive dissonance - curiously never come across it before without the cognitive bit.|||Are you just showing off?ah caint hep it!!