Showing posts with label runs. Show all posts
Showing posts with label runs. Show all posts

Thursday, March 8, 2012

cacheRemove

I have a stored proc with several input parameters and it runs very efficient
(14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
when drastically changing the parameters. I run the same stored proc on my
production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up to
15 minutes. The CPU usage on the production server is very low. When we ran a
trace on production we found that it was removing the cache and then of
course the cache would be missing and it would recompile - sometimes up to 10
or 15 times through the execution of the store proc. It doesn't do the
recompiling on the dev server. We feel certain that there must be a
difference in the configuration of either SQL server between the servers or
Windows. We aren't sure where to start looking.
It might be that the connection in which you are running the sp has
different enviorment settings than the dev connection. Run a profile trace
on both with the existing connection and connection Login to see if they are
the same. The sp can be poorly written and force recompilation as well. Do
you have temp tables in it? Have a look here:
http://support.microsoft.com/default.aspx?kbid=243586
Andrew J. Kelly SQL MVP
"James" <James@.discussions.microsoft.com> wrote in message
news:76AECD82-262E-428C-B0D9-E03A9FC49BCD@.microsoft.com...
>I have a stored proc with several input parameters and it runs very
>efficient
> (14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
> when drastically changing the parameters. I run the same stored proc on my
> production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up
> to
> 15 minutes. The CPU usage on the production server is very low. When we
> ran a
> trace on production we found that it was removing the cache and then of
> course the cache would be missing and it would recompile - sometimes up to
> 10
> or 15 times through the execution of the store proc. It doesn't do the
> recompiling on the dev server. We feel certain that there must be a
> difference in the configuration of either SQL server between the servers
> or
> Windows. We aren't sure where to start looking.

cacheRemove

I have a stored proc with several input parameters and it runs very efficient
(14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
when drastically changing the parameters. I run the same stored proc on my
production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up to
15 minutes. The CPU usage on the production server is very low. When we ran a
trace on production we found that it was removing the cache and then of
course the cache would be missing and it would recompile - sometimes up to 10
or 15 times through the execution of the store proc. It doesn't do the
recompiling on the dev server. We feel certain that there must be a
difference in the configuration of either SQL server between the servers or
Windows. We aren't sure where to start looking.It might be that the connection in which you are running the sp has
different enviorment settings than the dev connection. Run a profile trace
on both with the existing connection and connection Login to see if they are
the same. The sp can be poorly written and force recompilation as well. Do
you have temp tables in it? Have a look here:
http://support.microsoft.com/default.aspx?kbid=243586
--
Andrew J. Kelly SQL MVP
"James" <James@.discussions.microsoft.com> wrote in message
news:76AECD82-262E-428C-B0D9-E03A9FC49BCD@.microsoft.com...
>I have a stored proc with several input parameters and it runs very
>efficient
> (14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
> when drastically changing the parameters. I run the same stored proc on my
> production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up
> to
> 15 minutes. The CPU usage on the production server is very low. When we
> ran a
> trace on production we found that it was removing the cache and then of
> course the cache would be missing and it would recompile - sometimes up to
> 10
> or 15 times through the execution of the store proc. It doesn't do the
> recompiling on the dev server. We feel certain that there must be a
> difference in the configuration of either SQL server between the servers
> or
> Windows. We aren't sure where to start looking.

cacheRemove

I have a stored proc with several input parameters and it runs very efficien
t
(14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
when drastically changing the parameters. I run the same stored proc on my
production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up to
15 minutes. The CPU usage on the production server is very low. When we ran
a
trace on production we found that it was removing the cache and then of
course the cache would be missing and it would recompile - sometimes up to 1
0
or 15 times through the execution of the store proc. It doesn't do the
recompiling on the dev server. We feel certain that there must be a
difference in the configuration of either SQL server between the servers or
Windows. We aren't sure where to start looking.It might be that the connection in which you are running the sp has
different enviorment settings than the dev connection. Run a profile trace
on both with the existing connection and connection Login to see if they are
the same. The sp can be poorly written and force recompilation as well. Do
you have temp tables in it? Have a look here:
http://support.microsoft.com/default.aspx?kbid=243586
Andrew J. Kelly SQL MVP
"James" <James@.discussions.microsoft.com> wrote in message
news:76AECD82-262E-428C-B0D9-E03A9FC49BCD@.microsoft.com...
>I have a stored proc with several input parameters and it runs very
>efficient
> (14 seconds) on my dev server (PII-450 single processor, 512 mb ram), even
> when drastically changing the parameters. I run the same stored proc on my
> production server (dual Pentium 1 ghz, 1 or 2 gb ram) and it will take up
> to
> 15 minutes. The CPU usage on the production server is very low. When we
> ran a
> trace on production we found that it was removing the cache and then of
> course the cache would be missing and it would recompile - sometimes up to
> 10
> or 15 times through the execution of the store proc. It doesn't do the
> recompiling on the dev server. We feel certain that there must be a
> difference in the configuration of either SQL server between the servers
> or
> Windows. We aren't sure where to start looking.

Saturday, February 25, 2012

c0000005 EXCEPTION_ACCESS_VIOLATION

I have searched this newsgroup and Google. It seems that with this error I
should just call PSS? The SQL (see error.log attached) runs fine from Query
Analyzer, but not from my application (other queries run fine though). It
worked up until yesterday. I rebooted the server. I had an associate apply
SP4, but it still throws this exception. I'm having my partner run Dell
diags on it during lunch. The server is in California, I'm in Tennessee.
I also get this Events in the Event Log when the query is fired:
Event 17052, SOURCE: MSSQLSERVER
Error: 0, Severity: 19, State: 0
language_exec: Process 57 generated an access violation. SQL Server is
terminating this process.
AND
Event 17052, SOURCE: MSSQLSERVER
Error: 0, Severity: 19, State: 0
SqlDumpExceptionHandler: Process 57 generated fatal exception c0000005
EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
begin 666 error.log
M4W%L1'5M<$5X8V5P=&EO;DAA;F1L97(Z(%!R;V-E<W,@.-3(@.9V5N97)A=&5D
M(&9A=&%L(&5X8V5P=&EO;B!C,# P,# P-2!%6$-%4%1)3TY?04-#15-37U9)
M3TQ!5$E/3BX@.#0I344P@.4V5R=F5R(&ES('1E<FUI;F%T:6YG('1H:7,@.<' )O
M8V5S<RXN#0HJ("HJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ* BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ* BHJ*BHJ*BH-
M"BH-"BH@.0D5'24X@.4U1!0TL@.1%5-4#H-"BH@.(" P.2\P-R\P-2 P.#HR-#HQ
M-"!S<&ED(#4R#0HJ#0HJ(" @.17AC97!T:6]N($%D9')E<W,@./2 P,#0T1#%%
M,PT**B @.($5X8V5P=&EO;B!#;V1E(" @.(#T@.8S P,# P,#4@.15A#15!424].
M7T%#0T534U]624],051)3TX-"BH@.("!!8V-E<W,@.5FEO;&%T:6]N(&]C8W5R
M<F5D(')E861I;F<@.861D<F5S<R P,S(Y,# P, T**B!);G!U="!"=69F97(@.
M,S<V(&)Y=&5S("T-"BH@.(%-%3$5#5"!#05-%(&QE;BAR97!L86-E*&QO8V%T
M:6]N+"=B9RTG+"<G*2D@.5TA%3B Q(%1(14X@.)T)'+3 G("L@.<F5P;&%C90T*
M*B @.*&QO8V%T:6]N+"=B9RTG+"<G*2!%3%-%(&QO8V%T:6]N($5.1"P@.<&%R
M=&YU;2P@.=F5N9&]R+"!C87-E;G5M($923TT@.8V5N#0HJ("!T<F%L+F1B;RYT
M8FQG;'-I;G9S;F%P(%=(15)%(&1I=CTG3$U))R!!3D0@.;&]C871I;VX@.3$E+
M12 G0D<E)R!!3D0@.0T].5D4-"BH@.(%)4*&YV87)C:&%R+'-N87!D871E+#$P
M,2D])S Y+S Q+S(P,#4G($]21$52($)9($-!4T4@.;&5N*')E<&QA8V4H;&]C
M871I;PT**B @.;BPG8F<M)RPG)RDI(%=(14X@.,2!42$5.("="1RTP)R K(')E
M<&QA8V4H;&]C871I;VXL)V)G+2<L)R<I($5,4T4@.;&]C871I#0HJ("!O;B!%
M3D0L('!A<G1N=6T@.#0HJ(" -"BH-"BH@.($U/1%5,12 @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" @.(" @.0D%312 @.(" @.($5.1" @.(" @.("!325I%#0HJ('-Q;'-E
M<G9R(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,#0P,# P," @.,#!#0D%&1D8@.
M(# P.&)B,# P#0HJ(&YT9&QL(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W
M0S@.P,# P," @.-T,X0D9&1D8@.(# P,&,P,# P#0HJ(&ME<FYE;#,R(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" W-T4T,# P," @.-S=&-#%&1D8@.(# P,3 R,# P
M#0HJ($%$5D%023,R(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W-T8U,# P," @.
M-S=&14)&1D8@.(# P,#EC,# P#0HJ(%)00U)4-" @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" W-T,U,# P," @.-S=#145&1D8@.(# P,#EF,# P#0HJ($U35D-0
M-S$@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W0S-!,# P," @.-T,T,4%&1D8@.
M(# P,#=B,# P#0HJ($U35D-2-S$@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W
M0S,T,# P," @.-T,S.35&1D8@.(# P,#4V,# P#0HJ(&]P96YD<S8P(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" T,3 V,# P," @.-#$P-C5&1D8@.(# P,# V,# P
M#0HJ(%-(14Q,,S(@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W0SA$,# P," @.
M-T0P1#)&1D8@.(# P.# S,# P#0HJ($=$23,R(" @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" W-T,P,# P," @.-S=#-#=&1D8@.(# P,#0X,# P#0HJ(%5315(S
M,B @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W-S,X,# P," @.-S<T,3%&1D8@.
M(# P,#DR,# P#0HJ(&US=F-R=" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W
M-T)!,# P," @.-S="1CE&1D8@.(# P,#5A,# P#0HJ(%-(3%=!4$D@.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" W-T1!,# P," @.-S=$1C%&1D8@.(# P,#4R,# P
M#0HJ('-Q;'-O<G0@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" T,D%%,# P," @.
M-#)"-D9&1D8@.(# P,#DP,# P#0HJ('5M<R @.(" @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" T,3 W,# P," @.-#$P-T1&1D8@.(# P,#!E,# P#0HJ(&-O;6-T
M;#,R(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" W-S0R,# P," @.-S<U,C)&1D8@.
M(# P,3 S,# P#0HJ('-Q;&5V;C<P(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" T
M,3 X,# P," @.-#$P.$%&1D8@.(# P,#!B,# P#0HJ($Y%5$%023,R(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,S(P,# P," @.,#,R-3=&1D8@.(# P,#4X,# P
M#0HJ($%55$A" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,S(V,# P," @.
M,#,R-S-&1D8@.(# P,#$T,# P#0HJ($-/35)%4R @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P,S8Q,# P," @.,#,V1#5&1D8@.(# P,&,V,# P#0HJ(&]L93,R
M(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,S9%,# P," @.,#,X,3-&1D8@.
M(# P,3,T,# P#0HJ(%A/3$5(3% @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M,SA!,# P," @.,#,X035&1D8@.(# P,# V,# P#0HJ($U31%1#4%)8(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,SA",# P," @.,#,Y,C=&1D8@.(# P,#<X,# P
M#0HJ(&US=F-P-C @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,SDS,# P," @.
M,#,Y.3!&1D8@.(# P,#8Q,# P#0HJ($U46$-,52 @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P,SE!,# P," @.,#,Y0CA&1D8@.(# P,#$Y,# P#0HJ(%9%4E-)
M3TX@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,SE#,# P," @.,#,Y0S=&1D8@.
M(# P,# X,# P#0HJ(%=33T-+,S(@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M,SE$,# P," @.,#,Y1#A&1D8@.(# P,# Y,# P#0HJ(%=3,E\S,B @.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,SE%,# P," @.,#,Y1C9&1D8@.(# P,#$W,# P
M#0HJ(%=3,DA%3% @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,T$P,# P," @.
M,#-!,#=&1D8@.(# P,# X,# P#0HJ($],14%55#,R(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P,T$Q,# P," @.,#-!.4)&1D8@.(# P,#AC,# P#0HJ($-,55-!
M4$D@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,T%%,# P," @.,#-!1C%&1D8@.
M(# P,#$R,# P#0HJ(%)%4U5424Q3(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M,T(P,# P," @.,#-",3)&1D8@.(# P,#$S,# P#0HJ(%5315)%3E8@.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,T(R,# P," @.,#-"13-&1D8@.(# P,&,T,# P
M#0HJ('-E8W5R,S(@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,T)&,# P," @.
M,#-#,#)&1D8@.(# P,#$S,# P#0HJ($EN=F%L:60@.061D<F5S<R @.(" @.(" @.
M(" @.(" @.(" P,T,R,# P," @.,#-#-C!&1D8@.(# P,#0Q,# P#0HJ($EN=F%L
M:60@.061D<F5S<R @.(" @.(" @.(" @.(" @.(" P,T,W,# P," @.,#-#.3A&1D8@.
M(# P,#(Y,# P#0HJ('=I;G)N<B @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M,T-%,# P," @.,#-#139&1D8@.(# P,# W,# P#0HJ(%=,1$%0,S(@.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,T-&,# P," @.,#-$,41&1D8@.(# P,#)E,# P
M#0HJ(')A<V%D:&QP(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,T0T,# P," @.
M,#-$-#1&1D8@.(# P,# U,# P#0HJ($Y434%25$$@.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P,$4R,# P," @.,#!%-#%&1D8@.(# P,#(R,# P#0HJ(%-!34Q)
M0B @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P,$4U,# P," @.,#!%-45&1D8@.
M(# P,#!F,# P#0HJ(%-33D543$E"(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M,$4W,# P," @.,#!%.#5&1D8@.(# P,#$V,# P#0HJ('-E8W5R:71Y(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P,$4Y,# P," @.,#!%.3-&1D8@.(# P,# T,# P
M#0HJ(&AN971C9F<@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-#@.T,# P," @.
M,#0X.3A&1D8@.(# P,#4Y,# P#0HJ('=S:'1C<&EP(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-#A%,# P," @.,#0X13=&1D8@.(# P,# X,# P#0HJ(%-3;7-,
M4$-N(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-#DW,# P," @.,#0Y-S=&1D8@.
M(# P,# X,# P#0HJ(%-3;FU03C<P(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-#DX,# P," @.,#0Y.#9&1D8@.(# P,# W,# P#0HJ(&YT9'-A<&D@.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-$$Q,# P," @.,#1!,C1&1D8@.(# P,#$U,# P
M#0HJ(&ME<F)E<F]S(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-3!#,# P," @.
M,#4Q,3=&1D8@.(# P,#4X,# P#0HJ(&-R>7!T9&QL(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-3$R,# P," @.,#4Q,D)&1D8@.(# P,#!C,# P#0HJ($U305-.
M,2 @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-3$S,# P," @.,#4Q-#%&1D8@.
M(# P,#$R,# P#0HJ(%-13$9445)9(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-$(T,# P," @.,#1"-C5&1D8@.(# P,#(V,# P#0HJ('AP<W R<F5S(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" Q,# P,# P," @.,3 R0S1&1D8@.(# P,F,U,# P
M#0HJ($-,0D-A=%$@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-$(W,# P," @.
M,#1"1C)&1D8@.(# P,#@.S,# P#0HJ('-Q;&]L961B(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-$,R,# P," @.,#1#03!&1D8@.(# P,#@.Q,# P#0HJ($U31$%2
M5" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-$-",# P," @.,#1#0SE&1D8@.
M(# P,#%A,# P#0HJ($U31$%43#,@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-$-$,# P," @.,#1#131&1D8@.(# P,#$U,# P#0HJ(&]L961B,S(@.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-34V,# P," @.,#4U1#A&1D8@.(# P,#<Y,# P
M#0HJ($],141",S)2(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-35%,# P," @.
M,#4U1C!&1D8@.(# P,#$Q,# P#0HJ(')S865N:" @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-38P,# P," @.,#4V,D5&1D8@.(# P,#)F,# P#0HJ(%!305!)
M(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-31$,# P," @.,#4T1$%&1D8@.
M(# P,#!B,# P#0HJ(&US=C%?," @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-38S,# P," @.,#4V-39&1D8@.(# P,#(W,# P#0HJ(&EP:&QP87!I(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-38V,# P," @.,#4V-SE&1D8@.(# P,#%A,# P
M#0HJ('AP<W1A<B @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-38Y,# P," @.
M,#4V1$-&1D8@.(# P,#1D,# P#0HJ(%-13%)%4TQ$(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-39%,# P," @.,#4V14)&1D8@.(# P,#!C,# P#0HJ(%-13%-6
M0R @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-39&,# P," @.,#4W,$%&1D8@.
M(# P,#%B,# P#0HJ($]$0D,S,B @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-3<Q,# P," @.,#4W-$-&1D8@.(# P,#-D,# P#0HJ($-/34-43#,R(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-3<U,# P," @.,#4W139&1D8@.(# P,#DW,# P
M#0HJ(&-O;61L9S,R(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-3=&,# P," @.
M,#4X,SE&1D8@.(# P,#1A,# P#0HJ(&]D8F-B8W @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-3@.T,# P," @.,#4X-#5&1D8@.(# P,# V,# P#0HJ(%<Y-5-#
M32 @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-3@.U,# P," @.,#4X-4-&1D8@.
M(# P,#!D,# P#0HJ(%-13%5.25),(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-3@.V,# P," @.,#4X.$-&1D8@.(# P,#)D,# P#0HJ(%=)3E-03T],(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-3@.Y,# P," @.,#4X0C9&1D8@.(# P,#(W,# P
M#0HJ(%-(1D],1$52(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-3A#,# P," @.
M,#4X0SA&1D8@.(# P,# Y,# P#0HJ(&]D8F-I;G0@.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-4%!,# P," @.,#5!0C9&1D8@.(# P,#$W,# P#0HJ($Y$1$5!
M4$D@.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-4)$,# P," @.,#5"1#9&1D8@.
M(# P,# W,# P#0HJ(%-13%-60R @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-4)%,# P," @.,#5"135&1D8@.(# P,# V,# P#0HJ('AP<W1A<B @.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-4)&,# P," @.,#5"1CA&1D8@.(# P,# Y,# P
M#0HJ($%#5$E61413(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-4,P,# P," @.
M,#5#,S)&1D8@.(# P,#,S,# P#0HJ(&%D<VQD<&,@.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-4,T,# P," @.,#5#-C9&1D8@.(# P,#(W,# P#0HJ(&-R961U
M:2 @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-4,W,# P," @.,#5#.41&1D8@.
M(# P,#)E,# P#0HJ($%43" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-4-!,# P," @.,#5#0C=&1D8@.(# P,#$X,# P#0HJ(&%D<VQD<" @.(" @.(" @.
M(" @.(" @.(" @.(" @.(" @.(" P-40R,# P," @.,#5$-$1&1D8@.(# P,#)E,# P
M#0HJ(%-84R @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-45$,# P," @.
M,#5&.$)&1D8@.(# P,&)C,# P#0HJ('AP;&]G-S @.(" @.(" @.(" @.(" @.(" @.
M(" @.(" @.(" P-48Y,# P," @.,#5&.45&1D8@.(# P,#!F,# P#0HJ('AP;&]G
M-S @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P-49!,# P," @.,#5&031&1D8@.
M(# P,# U,# P#0HJ(&1B9VAE;' @.(" @.(" @.(" @.(" @.(" @.(" @.(" @.(" P
M-C!",# P," @.,#8Q049&1D8@.(# P,3 P,# P#0HJ#0HJ(" @.(" @.("!%9&DZ
M(# P,# P,# Q.B -"BH@.(" @.(" @.($5S:3H@.,#,R.3 S0T$Z( T**B @.(" @.
M(" @.16%X.B P,S(X1D9&13H@.#0HJ(" @.(" @.("!%8G@.Z(# U-35&,D,P.B P
M,# P,# P-B @.,# P,# P,#4@.(#0S-#8Q-S8P(" P,38R.$9#," @.-#)#-44Y
M138@.(#0S,C@.Y,D,X(" -"BH@.(" @.(" @.($5C>#H@.,#,R.$9&0T4Z(# P-D4P
M,#4U(" P,#<T,# V.2 @.,# W.# P-C4@.(# P-#<P,#(P(" P,#8Q,# V0R @.
M,# W,S P-S,@.( T**B @.(" @.(" @.161X.B P,# P,#%&13H@.#0HJ(" @.(" @.
M("!%:7 Z(# P-#1$,44S.B!&.3@.S,#@.X0B @.,3DX-C!&-T8@.(#A",# P-#DR
M("!&,#A"1D,T1" @.1D5$,48Q,D(@.(#@.T,$9$,C@.U(" -"BH@.(" @.(" @.($5B
M<#H@.,#4U-48R.#0Z(# U-35&-$%#(" P,#4S-C-!02 @.,# P,# P,#$@.(# U
M-35&,D$X(" P,# P,#%&12 @.,#4U-48U-#@.@.( T**B @.(" @.(%-E9T-S.B P
M,# P,# Q0CH@.#0HJ(" @.("!%1FQA9W,Z(# P,#$P,C@.S.B T1C P,# P," @.
M-3 P,#1$,# @.(#4T,# T,3 P(" S1# P-#@.P," @.,T$P,#0S,# @.(#4P,# U
M0S P(" -"BH@.(" @.(" @.($5S<#H@.,#4U-48R-S Z(# S,CA&1D-%(" P,# P
M,#1%-" @.-#,T-C@.P0S @.(# P,# P-$4T(" P,S(X1D9#12 @.,#4U-48T04,@.
M( T**B @.(" @.(%-E9U-S.B P,# P,# R,SH@.#0HJ("HJ*BHJ*BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ* BHJ*BHJ*BHJ
M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BH-"BH@.+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+ 2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+0T**B!3:&]R="!3=&%C:R!$=6UP#0HJ(# P-#1$,44S
M($UO9'5L92AS<6QS97)V<BLP,# T1#%%,RD-"BH@.,# U,S8S04$@.36]D=6QE
M*'-Q;'-E<G9R*S P,3,V,T%!*0T**B P,#4S-C,R."!-;V1U;&4H<W%L<V5R
M=G(K,# Q,S8S,C@.I#0HJ(# P-#(Y1D$Y($UO9'5L92AS<6QS97)V<BLP,# R
M.49!.2D-"BH@.,# T,$,S03<@.36]D=6QE*'-Q;'-E<G9R*S P,#!#,T$W*0T*
M*B P,#0Q1#$W."!-;V1U;&4H<W%L<V5R=G(K,# P,40Q-S@.I#0HJ(# P-#(Y
M.30Q($UO9'5L92AS<6QS97)V<BLP,# R.3DT,2D-"BH@.,# T,CE%04$@.36]D
M=6QE*'-Q;'-E<G9R*S P,#(Y14%!*0T**B P,#0Q-40P-"!-;V1U;&4H<W%L
M<V5R=G(K,# P,35$,#0I#0HJ(# P-#$V,C$T($UO9'5L92AS<6QS97)V<BLP
M,# Q-C(Q-"D-"BH@.,# T,35&,C@.@.36]D=6QE*'-Q;'-E<G9R*S P,#$U1C(X
M*0T**B P,#0Y0S,R12!-;V1U;&4H<W%L<V5R=G(K,# P.4,S,D4I#0HJ(# P
M-#E#-#9!($UO9'5L92AS<6QS97)V<BLP,# Y0S0V02D-"BH@.-#$P-S4S,#D@.
M36]D=6QE*'5M<RLP,# P-3,P.2D@.*%!R;V-E<W-7;W)K4F5Q=65S=',K,# P
M,# R1#D@.3&EN92 T-38K,# P,# P,# I#0HJ(#0Q,#<T.3<X($UO9'5L92AU
M;7,K,# P,#0Y-S@.I("A4:')E8613=&%R=%)O=71I;F4K,# P,# P.3@.@.3&EN
M92 R-C,K,# P,# P,#<I#0HJ(#=#,S0Y-#!&($UO9'5L92A-4U9#4C<Q*S P
M,# Y-#!&*2 H96YD=&AR96%D*S P,# P,$%!*0T**B W-T4V-C V,R!-;V1U
M;&4H:V5R;F5L,S(K,# P,C8P-C,I("A'971-;V1U;&5&:6QE3F%M94$K,# P
M,# P14(I#0HJ("TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+ 2TM+2TM
;+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
`
end
"Mike Smith" <msmith@.larrymethvin.com> wrote in message
news:OS7pVV9sFHA.3752@.TK2MSFTNGP09.phx.gbl...
> I have searched this newsgroup and Google. It seems that with this error I
> should just call PSS? The SQL (see error.log attached) runs fine from
Query
> Analyzer, but not from my application (other queries run fine though). It
> worked up until yesterday. I rebooted the server. I had an associate apply
> SP4, but it still throws this exception. I'm having my partner run Dell
> diags on it during lunch. The server is in California, I'm in Tennessee.
> I also get this Events in the Event Log when the query is fired:
> Event 17052, SOURCE: MSSQLSERVER
> Error: 0, Severity: 19, State: 0
> language_exec: Process 57 generated an access violation. SQL Server is
> terminating this process.
> AND
> Event 17052, SOURCE: MSSQLSERVER
> Error: 0, Severity: 19, State: 0
> SqlDumpExceptionHandler: Process 57 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
>
Sorry, specs:
Dell PowerEdge, Windows 2003 SP1, SQL2000 SP4.
The only change I am aware of is SP4, previously (yesterday), it had SP3a.
Regards,
Mike Smith
msmith@.larrymethvin.com
|||"Mike Smith" <msmith@.larrymethvin.com> wrote in message
news:OS7pVV9sFHA.3752@.TK2MSFTNGP09.phx.gbl...
>I have searched this newsgroup and Google. It seems that with this error I
> should just call PSS?
Yes.
David
|||"Mike Smith" <msmith@.larrymethvin.com> wrote in message
news:OS7pVV9sFHA.3752@.TK2MSFTNGP09.phx.gbl...
> I have searched this newsgroup and Google. It seems that with this error I
> should just call PSS? The SQL (see error.log attached) runs fine from
Query
> Analyzer, but not from my application (other queries run fine though). It
> worked up until yesterday. I rebooted the server. I had an associate apply
> SP4, but it still throws this exception. I'm having my partner run Dell
> diags on it during lunch. The server is in California, I'm in Tennessee.
> I also get this Events in the Event Log when the query is fired:
> Event 17052, SOURCE: MSSQLSERVER
> Error: 0, Severity: 19, State: 0
> language_exec: Process 57 generated an access violation. SQL Server is
> terminating this process.
> AND
> Event 17052, SOURCE: MSSQLSERVER
> Error: 0, Severity: 19, State: 0
> SqlDumpExceptionHandler: Process 57 generated fatal exception c0000005
> EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
>
For the sake of the list, and anyone else that may have this problem. I
checked my log files, they were HUGE! We had moved servers, and whoever
setup the backups didn't back up the logs. I shrank the logs using the
method in: http://support.microsoft.com/kb/272318

C/S and T/S using same DB simultaneously

I have a VB6 application that runs in both a client server or a terminal
services environment. Normally a customer uses one or the other. Is it
possible for a customer to install and run both of these at the same time
meaning they have the C/S connected to some users and the T/S connecting
other users but they both access one SQL server database? I had not
considered this situation before.
BruceL
Bruce,
I don't know why not. Whether the client code runs C/S or T/S is moot to
the SQL Server, since it knows very little about the client. It talks via
the communication protocols and grants rights to 'you', whoever you are.
The main issue is probably: Who are you in each of these environments? Are
you in the same security context, or not? But, however you are managing
access to the SQL Server will control who can log in and what rights are
granted.
RLF
"BruceL" <BruceL@.discussions.microsoft.com> wrote in message
news:268FAFAE-6729-4227-A95E-D60A02AEB119@.microsoft.com...
>I have a VB6 application that runs in both a client server or a terminal
> services environment. Normally a customer uses one or the other. Is it
> possible for a customer to install and run both of these at the same time
> meaning they have the C/S connected to some users and the T/S connecting
> other users but they both access one SQL server database? I had not
> considered this situation before.
> --
> BruceL
|||Thanks for the answer Russell
BruceL
"Russell Fields" wrote:

> Bruce,
> I don't know why not. Whether the client code runs C/S or T/S is moot to
> the SQL Server, since it knows very little about the client. It talks via
> the communication protocols and grants rights to 'you', whoever you are.
> The main issue is probably: Who are you in each of these environments? Are
> you in the same security context, or not? But, however you are managing
> access to the SQL Server will control who can log in and what rights are
> granted.
> RLF
> "BruceL" <BruceL@.discussions.microsoft.com> wrote in message
> news:268FAFAE-6729-4227-A95E-D60A02AEB119@.microsoft.com...
>
>

C/S and T/S using same DB simultaneously

I have a VB6 application that runs in both a client server or a terminal
services environment. Normally a customer uses one or the other. Is it
possible for a customer to install and run both of these at the same time
meaning they have the C/S connected to some users and the T/S connecting
other users but they both access one SQL server database? I had not
considered this situation before.
--
BruceLBruce,
I don't know why not. Whether the client code runs C/S or T/S is moot to
the SQL Server, since it knows very little about the client. It talks via
the communication protocols and grants rights to 'you', whoever you are.
The main issue is probably: Who are you in each of these environments? Are
you in the same security context, or not? But, however you are managing
access to the SQL Server will control who can log in and what rights are
granted.
RLF
"BruceL" <BruceL@.discussions.microsoft.com> wrote in message
news:268FAFAE-6729-4227-A95E-D60A02AEB119@.microsoft.com...
>I have a VB6 application that runs in both a client server or a terminal
> services environment. Normally a customer uses one or the other. Is it
> possible for a customer to install and run both of these at the same time
> meaning they have the C/S connected to some users and the T/S connecting
> other users but they both access one SQL server database? I had not
> considered this situation before.
> --
> BruceL|||Thanks for the answer Russell
--
BruceL
"Russell Fields" wrote:
> Bruce,
> I don't know why not. Whether the client code runs C/S or T/S is moot to
> the SQL Server, since it knows very little about the client. It talks via
> the communication protocols and grants rights to 'you', whoever you are.
> The main issue is probably: Who are you in each of these environments? Are
> you in the same security context, or not? But, however you are managing
> access to the SQL Server will control who can log in and what rights are
> granted.
> RLF
> "BruceL" <BruceL@.discussions.microsoft.com> wrote in message
> news:268FAFAE-6729-4227-A95E-D60A02AEB119@.microsoft.com...
> >I have a VB6 application that runs in both a client server or a terminal
> > services environment. Normally a customer uses one or the other. Is it
> > possible for a customer to install and run both of these at the same time
> > meaning they have the C/S connected to some users and the T/S connecting
> > other users but they both access one SQL server database? I had not
> > considered this situation before.
> > --
> > BruceL
>
>

Friday, February 24, 2012

C# Replication

I have a c# application that runs off a local database. This application is
used by marketers to keep track of their leads and appointments. Currently
two marketers are using this application on laptops. Obvisouly the two
marketers will have different data on their laptops. They need to share the
same data and the only way to do this is through merging the databases.
I thought about merging the database on the laptop with a database on our
local server, and then the server and laptop will be updated with the latest
information.
I need to do this through c# and I'm having trouble setting up sql to make
use of merging.
Please help me on ideas or how to go about this.
ThanxI take it you are talking about merge replication. Use the Replication
Wizard to create a merge publication. You can then use the merge replication
ActiveX control to pull this
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using System.Net;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using SQLINITXLib;
using SQLMERGXLib;
namespace MergeDemo1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.DataGrid dataGrid1;
public System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.DataGrid dataGrid2;
private SqlDataAdapter SQLDataAdapterPub;
private SqlDataAdapter SQLDataAdapterSub;
private DataSet DataSetPub=new DataSet();
private DataSet DataSetSub=new DataSet();
public event _SQLMergeEvents_StatusEventHandler StatusEventMerge;
public event _SQLSnapshotEvents_StatusEventHandler StatusEventSnapshot;
private System.Windows.Forms.Button UpdatePublisher;
private System.Windows.Forms.Button UpdateSubscriber;
private System.Windows.Forms.Button CloseButton;
private System.Windows.Forms.Label SubscriberConflicts;
private System.Windows.Forms.Label SubscriberChanges;
private System.Windows.Forms.Label PublisherChanges;
private System.Windows.Forms.Label PublisherConflicts;
private System.Windows.Forms.Button Sync;
private System.Windows.Forms.ProgressBar progressBar1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.UpdatePublisher = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.CloseButton = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.UpdateSubscriber = new System.Windows.Forms.Button();
this.Sync = new System.Windows.Forms.Button();
this.SubscriberConflicts = new System.Windows.Forms.Label();
this.SubscriberChanges = new System.Windows.Forms.Label();
this.PublisherChanges = new System.Windows.Forms.Label();
this.PublisherConflicts = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(24, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(144, 48);
this.button1.TabIndex = 0;
this.button1.Text = "Click to generate and distribute Snapshot";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(48, 168);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(832, 272);
this.dataGrid1.TabIndex = 2;
//
// UpdatePublisher
//
this.UpdatePublisher.Location = new System.Drawing.Point(208, 16);
this.UpdatePublisher.Name = "UpdatePublisher";
this.UpdatePublisher.Size = new System.Drawing.Size(152, 48);
this.UpdatePublisher.TabIndex = 3;
this.UpdatePublisher.Text = "Click to Update Publisher";
this.UpdatePublisher.Visible = false;
this.UpdatePublisher.Click += new
System.EventHandler(this.UpdatePublisher_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(112, 128);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(760, 32);
this.label1.TabIndex = 4;
this.label1.Text = "label1";
this.label1.Visible = false;
//
// CloseButton
//
this.CloseButton.Location = new System.Drawing.Point(592, 16);
this.CloseButton.Name = "CloseButton";
this.CloseButton.Size = new System.Drawing.Size(152, 48);
this.CloseButton.TabIndex = 5;
this.CloseButton.Text = "Close";
this.CloseButton.Click += new System.EventHandler(this.Close_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(48, 128);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 32);
this.label2.TabIndex = 6;
this.label2.Text = "Publisher";
//
// label3
//
this.label3.Location = new System.Drawing.Point(48, 472);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 32);
this.label3.TabIndex = 8;
this.label3.Text = "Subscriber";
//
// dataGrid2
//
this.dataGrid2.DataMember = "";
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(48, 512);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.Size = new System.Drawing.Size(832, 272);
this.dataGrid2.TabIndex = 7;
//
// UpdateSubscriber
//
this.UpdateSubscriber.Location = new System.Drawing.Point(208, 456);
this.UpdateSubscriber.Name = "UpdateSubscriber";
this.UpdateSubscriber.Size = new System.Drawing.Size(152, 48);
this.UpdateSubscriber.TabIndex = 9;
this.UpdateSubscriber.Text = "Click to Update Subscriber";
this.UpdateSubscriber.Visible = false;
this.UpdateSubscriber.Click += new
System.EventHandler(this.UpdateSubscriber_Click);
//
// Sync
//
this.Sync.Location = new System.Drawing.Point(400, 16);
this.Sync.Name = "Sync";
this.Sync.Size = new System.Drawing.Size(152, 48);
this.Sync.TabIndex = 10;
this.Sync.Text = "Synchronize";
this.Sync.Visible = false;
this.Sync.Click += new System.EventHandler(this.Sync_Click);
//
// SubscriberConflicts
//
this.SubscriberConflicts.Location = new System.Drawing.Point(376, 456);
this.SubscriberConflicts.Name = "SubscriberConflicts";
this.SubscriberConflicts.Size = new System.Drawing.Size(144, 24);
this.SubscriberConflicts.TabIndex = 11;
this.SubscriberConflicts.Text = "Subscriber Conflicts: 0";
//
// SubscriberChanges
//
this.SubscriberChanges.Location = new System.Drawing.Point(512, 456);
this.SubscriberChanges.Name = "SubscriberChanges";
this.SubscriberChanges.Size = new System.Drawing.Size(144, 24);
this.SubscriberChanges.TabIndex = 12;
this.SubscriberChanges.Text = "Subscriber Changes: 0";
//
// PublisherChanges
//
this.PublisherChanges.Location = new System.Drawing.Point(512, 80);
this.PublisherChanges.Name = "PublisherChanges";
this.PublisherChanges.Size = new System.Drawing.Size(144, 24);
this.PublisherChanges.TabIndex = 14;
this.PublisherChanges.Text = "Publisher Changes: 0";
//
// PublisherConflicts
//
this.PublisherConflicts.Location = new System.Drawing.Point(376, 80);
this.PublisherConflicts.Name = "PublisherConflicts";
this.PublisherConflicts.Size = new System.Drawing.Size(144, 24);
this.PublisherConflicts.TabIndex = 13;
this.PublisherConflicts.Text = "Publisher Conflicts: 0";
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(112, 152);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(168, 8);
this.progressBar1.TabIndex = 15;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(896, 853);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.PublisherChanges);
this.Controls.Add(this.PublisherConflicts);
this.Controls.Add(this.SubscriberChanges);
this.Controls.Add(this.SubscriberConflicts);
this.Controls.Add(this.Sync);
this.Controls.Add(this.UpdateSubscriber);
this.Controls.Add(this.label3);
this.Controls.Add(this.dataGrid2);
this.Controls.Add(this.label2);
this.Controls.Add(this.CloseButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.UpdatePublisher);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Merge Demo";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{}
private void Synchronize()
{
//run snapshot
//synchronize mergesub
Snapshot();
Synchronzie_mergesub();
}
private void Snapshot()
{
SQLSnapshot objSnapshot= new SQLSnapshotClass();
objSnapshot.Publisher = System.Environment.MachineName.ToString();
objSnapshot.PublisherSecurityMode =
SQLINITXLib.SECURITY_TYPE.NT_AUTHENTICATION;
objSnapshot.PublisherDatabase = "Northwind";
objSnapshot.Publication = "Northwind";
objSnapshot.ReplicationType=SQLINITXLib.REPLICATION_TYPE.MERGE;
objSnapshot.Distributor = System.Environment.MachineName.ToString();
objSnapshot.DistributorSecurityMode =
SQLINITXLib.SECURITY_TYPE.NT_AUTHENTICATION;
objSnapshot.Status +=new
_SQLSnapshotEvents_StatusEventHandler(ob
jSnapshot_Status);
try
{
button1.Visible=false;
label1.Visible=true;
label1.Text = "Generating snapshot...";
label1.Refresh();
objSnapshot.Initialize();
objSnapshot.Run();
objSnapshot.Terminate();
label1.Text = "Snapshot generated...";
label1.Refresh();
}
catch (Exception e)
{
MessageBox.Show(e.StackTrace);
MessageBox.Show(e.Message);
}
}
private void Synchronzie_mergesub()
{
SQLMergeClass objMerge = new SQLMergeClass();
objMerge.Publisher=System.Environment.MachineName.ToString();
objMerge.Publisher=Dns.GetHostName();
objMerge.PublisherDatabase="Northwind";
objMerge.Publication="Northwind";
objMerge.PublisherSecurityMode=SQLMERGXLib.SECURITY_TYPE.NT_AUTHENTICATION;
objMerge.Subscriber=System.Environment.MachineName.ToString();
objMerge.SubscriberDatabase="mergesub";
objMerge.SubscriberSecurityMode=SQLMERGXLib.SECURITY_TYPE.NT_AUTHENTICATION;
objMerge.Status +=new
_SQLMergeEvents_StatusEventHandler(objMe
rge_Status);
try
{
label1.Visible=true;
label1.Text="Initializing Merge Sub";
label1.Refresh();
objMerge.Initialize();
objMerge.Run();
label1.Text="Running Merge Agent";
label1.Refresh();
objMerge.Terminate();
label1.Text="Merge Agent complete";
label1.Refresh();
}
catch(Exception e)
{
MessageBox.Show(e.StackTrace);
MessageBox.Show(e.Message);
}
PublisherConflicts.Text="Publisher Conflicts: " +
objMerge.PublisherConflicts.ToString();
PublisherConflicts.Update();
PublisherChanges.Text="Publisher Changes: " +
objMerge.PublisherChanges.ToString();
PublisherChanges.Update();
SubscriberConflicts.Text="Subscriber Conflicts: " +
objMerge.SubscriberConflicts.ToString();
SubscriberConflicts.Update();
SubscriberChanges.Text="Subscriber Changes: " +
objMerge.SubscriberChanges.ToString();
SubscriberChanges.Update();
}
public void button1_Click(object sender, System.EventArgs e)
{
Synchronize();
PopulateDataGrids();
}
public void PopulateDataGrids()
{
SqlConnection objConnectionPub = null;
SqlConnection objConnectionSub = null;
try
{
objConnectionPub = new
SqlConnection("Data Source=(local);Integrated Security=SSPI;Initial
Catalog=Northwind");
objConnectionSub = new
SqlConnection("Data Source=(local);Integrated Security=SSPI;Initial
Catalog=mergesub");
//SQLDataAdapaterPub(
this.SQLDataAdapterPub= new SqlDataAdapter("Select * from
Customers",objConnectionPub);
this.SQLDataAdapterSub= new SqlDataAdapter("Select * from
Customers",objConnectionSub);
DataSetPub.Clear();
DataSetSub.Clear();
SQLDataAdapterPub.Fill(DataSetPub, "Customers");
SQLDataAdapterSub.Fill(DataSetSub, "Customers");
dataGrid1.DataSource = DataSetPub.DefaultViewManager;
dataGrid1.DataMember="Customers";
dataGrid2.DataSource = DataSetSub.DefaultViewManager;
dataGrid2.DataMember="Customers";
UpdatePublisher.Visible=true;
UpdateSubscriber.Visible=true;
SqlCommandBuilder commandBuilderPub = new
SqlCommandBuilder(SQLDataAdapterPub);
SqlCommandBuilder commandBuilderSub = new
SqlCommandBuilder(SQLDataAdapterSub);
}
catch (Exception oE)
{
MessageBox.Show("Problem Populating DataGrid: [" + oE.ToString() + "]");
}
finally
{
if (objConnectionPub!= null )
{
if (objConnectionPub.State == ConnectionState.Open)
objConnectionPub.Close();
}
if (objConnectionSub!= null )
{
if (objConnectionSub.State == ConnectionState.Open)
objConnectionSub.Close();
}
}
}
private void Close_Click(object sender, System.EventArgs e)
{
this.Close();
}
public void UpdatePublisher_Click(object sender, System.EventArgs e)
{
UpdateSubscriber.Visible=true;
if(DataSetPub!= null && DataSetPub.HasChanges())
{
SQLDataAdapterPub.Update(DataSetPub, "Customers");
}
Sync.Visible=true;
}
public SQLINITXLib.STATUS_RETURN_CODE objSnapshot_Status(string Message,
int Percent)
{
label1.Text=Message.ToString() +" " +Percent.ToString() + "% complete.";
label1.Update();
progressBar1.Value=Percent;
progressBar1.Update();
StatusEventSnapshot(Message, Percent);
return new SQLINITXLib.STATUS_RETURN_CODE ();
}
public SQLMERGXLib.STATUS_RETURN_CODE objMerge_Status(string Message, int
Percent)
{
label1.Text=Message.ToString() +" " +Percent.ToString() + "% complete.";
label1.Update();
progressBar1.Value=Percent;
progressBar1.Update();
StatusEventMerge(Message, Percent);
return new SQLMERGXLib.STATUS_RETURN_CODE ();
}
private void UpdateSubscriber_Click(object sender, System.EventArgs e)
{
UpdateSubscriber.Visible=true;
if(DataSetSub!= null && DataSetSub.HasChanges())
{
SQLDataAdapterSub.Update(DataSetSub, "Customers");
}
Sync.Visible=true;
}
private void Sync_Click(object sender, System.EventArgs e)
{
Synchronzie_mergesub();
PopulateDataGrids();
dataGrid1.Update();
}
}
}
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
"Developer" <Developer@.discussions.microsoft.com> wrote in message
news:3E371B74-9DC6-458D-9169-419D741CD547@.microsoft.com...
> I have a c# application that runs off a local database. This application
is
> used by marketers to keep track of their leads and appointments. Currently
> two marketers are using this application on laptops. Obvisouly the two
> marketers will have different data on their laptops. They need to share
the
> same data and the only way to do this is through merging the databases.
> I thought about merging the database on the laptop with a database on our
> local server, and then the server and laptop will be updated with the
latest
> information.
> I need to do this through c# and I'm having trouble setting up sql to make
> use of merging.
> Please help me on ideas or how to go about this.
> Thanx|||The following article describes how to use offline MSDE installations as
merge replication subscribers to an online SQL Server acting as a publisher.
http://support.microsoft.com/defaul...kb;en-us;324992
"Developer" <Developer@.discussions.microsoft.com> wrote in message
news:3E371B74-9DC6-458D-9169-419D741CD547@.microsoft.com...
>I have a c# application that runs off a local database. This application is
> used by marketers to keep track of their leads and appointments. Currently
> two marketers are using this application on laptops. Obvisouly the two
> marketers will have different data on their laptops. They need to share
> the
> same data and the only way to do this is through merging the databases.
> I thought about merging the database on the laptop with a database on our
> local server, and then the server and laptop will be updated with the
> latest
> information.
> I need to do this through c# and I'm having trouble setting up sql to make
> use of merging.
> Please help me on ideas or how to go about this.
> Thanx