|
Is the scripted SQL marked up with anything?? Like Go statements, semi-colons, whatever...??
|
|
|
|
|
If I take the .TextBody string that this sub creates, and paste it into SQL Server Management Studio in a new Stored Procedure window, and press "Execute", the stored procedure is created perfectly.
If I run this sub, it fails.
(The mMyDatabase var is populated with a properly-connected database/connection.)
I've tried removing the BEGIN/END items, removing the parameters, changing the .TextMode, the .AnsiNullsStatus, the .QuotedIdentifierStatus, in every combination I can think of, and it still fails.
Thanks for any help!
Public Sub CreateInsertActivityStoredProcedure()
Dim Name As String = "InsertActivityRow"
If mMyDatabase.StoredProcedures.Contains(Name) Then
mMyDatabase.StoredProcedures(Name).Drop()
End If
Dim An_SP As New StoredProcedure(mMyDatabase, Name, "dbo")
'An_SP.TextHeader = "???"
An_SP.TextMode = False
An_SP.AnsiNullsStatus = False
An_SP.QuotedIdentifierStatus = False
'these are the input paramters
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@UserFK", DataType.Int))
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@MachineFK", DataType.Int))
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@ActivityDate", DataType.DateTime))
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@Activity", DataType.Int))
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@TableAffected", DataType.Int))
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@RowAffected", DataType.Int))
'this is the output parameter
Dim An_OutputParameter As StoredProcedureParameter = New StoredProcedureParameter(An_SP, "@NewPK", DataType.Int)
An_OutputParameter.IsOutputParameter = True
An_SP.Parameters.Add(An_OutputParameter)
'start the string (the rest use += )
An_SP.TextBody = ""
An_SP.TextBody += "CREATE PROCEDURE InsertActivityRow"
An_SP.TextBody += " @UserFK int,"
An_SP.TextBody += " @MachineFK int,"
An_SP.TextBody += " @ActivityDate datetime,"
An_SP.TextBody += " @Activity int,"
An_SP.TextBody += " @TableAffected int,"
An_SP.TextBody += " @RowAffected int,"
An_SP.TextBody += " @NewPK int OUT"
An_SP.TextBody += " AS"
An_SP.TextBody += " BEGIN"
An_SP.TextBody += " SET NOCOUNT ON"
An_SP.TextBody += " INSERT INTO ADV4SQL.dbo.ADVActivities"
An_SP.TextBody += " ("
An_SP.TextBody += " AcUserFK,"
An_SP.TextBody += " AcMachineFK,"
An_SP.TextBody += " AcDate,"
An_SP.TextBody += " AcActivity,"
An_SP.TextBody += " AcTableAffected,"
An_SP.TextBody += " AcRowAffected"
An_SP.TextBody += " )"
An_SP.TextBody += " VALUES"
An_SP.TextBody += " ("
An_SP.TextBody += " @UserFK,"
An_SP.TextBody += " @MachineFK,"
An_SP.TextBody += " @ActivityDate,"
An_SP.TextBody += " @Activity,"
An_SP.TextBody += " @TableAffected,"
An_SP.TextBody += " @RowAffected"
An_SP.TextBody += " )"
An_SP.TextBody += " SET @NewPK = SCOPE_IDENTITY() "
An_SP.TextBody += " END"
An_SP.Create()
End Sub
modified on Sunday, May 17, 2009 3:48 PM
|
|
|
|
|
RESOLVED !!
Thanks for your help. With a little more research, I was able to find and solve the problem. I found the error in the "InnerException". The error was: "Invalid syntax near 'PROCEDURE'". So I rechecked the sample code and noticed that the sample code did not have "CREATE PROCEDURE" in the .TextBody property.
Answer:
The lines below (marked BAD LINES) are not needed in the TextBody property, since they are actually created programmatically by SMO when the stored procedure is created with:
Dim An_SP As New StoredProcedure(mMyDatabase, Name, "dbo") As well, the lines defining the parameters are not needed since the parameters are created programmatically by SMO with:
An_SP.Parameters.Add(New StoredProcedureParameter(An_SP, "@UserFK", DataType.Int)) BAD LINES:
An_SP.TextBody += "CREATE PROCEDURE InsertActivityRow"
An_SP.TextBody += " @UserFK int,"
An_SP.TextBody += " @MachineFK int,"
An_SP.TextBody += " @ActivityDate datetime,"
An_SP.TextBody += " @Activity int,"
An_SP.TextBody += " @TableAffected int,"
An_SP.TextBody += " @RowAffected int,"
An_SP.TextBody += " @NewPK int OUT"
An_SP.TextBody += " AS"
An_SP.TextBody += " BEGIN" and
An_SP.TextBody += " END"
|
|
|
|
|
Hi,
I´m looking for control like Corel Draw tool text editor or similar.
Do you know something like this ?
I´m using a Rich Text Box, but the font render is very diferent to font render of pdf library (iText),
( the RTB render text using GDI and iText render text using GDI+ )
I need write text, with any format ( font size, styles...), and then generate PDF document.
( what you see in screen must be identical in PDF )
somebody help me please
thanks!
|
|
|
|
|
Hi,
My requirement is my Windows application should check periodically for latest updates on some network or web location and users can download only changed files. I found ClickOnce is helpful for this but also I am not sure that it is designed for only sandbox execution/only for current user context or once downloaded, the application can be used by any user on that machine.
My application is going to be installed once on multiple machines on shared way so any user logs on should be able to run it.
How can I achieve this task?
Your ideas please.
Thanks.
|
|
|
|
|
hi
i need to split a string ATTATCGATGATATTATTGGTCTTATTTGT into each alphabet..
after splitting each index of the array should hold each alphabet eg. splitseq (0) = A, splitseq(1) = T n so on till the end of the sequence..
FYI its a gene sequence
pls reply urgently.....!!!!
|
|
|
|
|
So you're splitting it into a char array? There's a big hint in that sentence.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Don't cross-post. The daily CCC should be posted in the Lounge only.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi poojapande;
You can use the ToCharArray method of the string class as shown in the code snippet.
Dim geneSeq As String = "ATTATCGATGATATTATTGGTCTTATTTGT"
Dim splitseq() As Char
splitseq = geneSeq.ToCharArray()
' Display the splitseq array
For Each ch As Char In splitseq
Console.WriteLine(ch)
Next
Fernando
|
|
|
|
|
Dear ALL,
How Can I Disable "Print" And "Save As" Options From a Sharepoint Server MOSS 2007 document library, so the users will be able only to view the document (Word, PDF,...) And no one will be able to Print Or Make a Save As for all the documents in this document library.
Regards,
|
|
|
|
|
I had installed the Intel fortran in my PC.
I had created the Test.F90 (fortran code)
SUBROUTINE GetNum (num, unit)
REAL*8 num,unit
unit = num+10
RETURN
END
I had created the c++ code in Microsft Visual studio 2005.
#include<iostream>
using namespace std;
extern "C"
{
__declspec(dllimport)
void _stdcall GetNum(double&,double&);
}
void main()
{
cout << "Hi MalliKARJUN" << endl;
double a,b;
a=10.0;
b=0.0;
GetNum(a,b);
}
I had added the fortan dependencis project with the above c++ project .
Above c++ project compile successfullly but it gives following errro while we build the code
error LNK2019: unresolved external symbol __imp__GetNum@8 referenced in function _main
Kindly help me out to resolve this issue
|
|
|
|
|
Hi,
I have the following warning when i build the setup project requiring 3.5 sp1.
Warning 1 Could not find prerequisite '.NET Framework 3.5 SP1' in path 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\'
I used instructions from http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/VS2008SP1Readme.htm#General%20Issues[^] to copy net 3.5 sp1 to bootstrapper and modify product.xml as necessary.
The modifications were
<PackageFile Name="dotNetFX30\XPSEPSC-x86-en-US.exe" PublicKey="3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001" />
<PackageFile Name="dotNetFX30\XPSEPSC-amd64-en-US.exe" PublicKey="3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001" />
and added right after <PackageFiles CopyAllPackageFiles="IfNotHomeSite">
< PackageFile Name="TOOLS\clwireg.exe" />
< PackageFile Name="TOOLS\clwireg_x64.exe" />
< PackageFile Name="TOOLS\clwireg_ia64.exe" />
However i get that warning and i am unable to add net 3.5 sp1 to setup project. The solutions i found were to check again product.xml file and it's ok, restart, clean solution rebuild. Didn't work. Do you have some other suggestions?
Thank you
P.S. I hope this is the correct thread
|
|
|
|
|
Hi,
I have the following warning when i build the setup project requiring 3.5 sp1.
Warning 1 Could not find prerequisite '.NET Framework 3.5 SP1' in path 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\'
I used instructions from http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/VS2008SP1Readme.htm#General%20Issues[^] to copy net 3.5 sp1 to bootstrapper and modify product.xml as necessary.
However i get that warning and i am unable to add net 3.5 sp1 to setup project. The solutions i found were to check again product.xml file and it's ok, restart, clean solution rebuild. Didn't work. Do you have some other suggestions?
Thank you
P.S. Deleted modifications to product.xml for a better view of post
|
|
|
|
|
Solved. In file product.xml i added
<PackageFile Name="TOOLS\clwireg.exe"/>
<PackageFile Name="TOOLS\clwireg_x64.exe"/>
<PackageFile Name="TOOLS\clwireg_ia64.exe"/>
which had a space before PackageFile which had to be removed for all 3 entries
|
|
|
|
|
I want to import contacts from windows address book in c# or vb.net. can anyone help me with that.
|
|
|
|
|
Hello!
I want to Delete Record from Data Grid if Check Box is checked, its a windows mobile application.
please help me.
Thanks.
sssssssss
|
|
|
|
|
the form has a field of MainMenu.
help me, how to paint the mainMenu, please.
|
|
|
|
|
You need to provide a lot more information than this. What form? Win Forms? What's the main menu?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I am working on AD RMS so can u plz tell me that how to get the machine certificate and
how to get the User License and How to get RAC(Rights Account Certificate)
PLease tell me that what is needed the first.
|
|
|
|
|
Can we use .Net Remoting if we have a COM client? That is, have a .net remoting object, a .net listener and a com client to request for the .net remote object?
|
|
|
|
|
Hi,
I can´t understand this:
help!
I´m developing application, and it´s using iText Library for generate PDF. The text input must be Rich formated. The pdf document generated, must be exactly equal to text. I´m parsed the text, for generated font name, color,size and then, the objects needed for iText ( it´s not support RTF to PDF conversions )
I´m using RichEdit Control, but the font size is not correct in comparission with the generated pdf. ( also are images objects ).
Then, I did a SIMPLE test with the DrawString method (gdi), ( same text, same font name and font size ), but they are not equal WIDTH. ( Richtext and drawtext ).
Conclusion: using a DrawString method generated the correct pdf (correct size).
The height and the size of each character are equal. The only diference is the char spacing
Why occurs this ?
I need resolve this problem with the fuc... Rich Edit Control.
Thanks!
PS: sorry for my poor english
modified on Wednesday, May 13, 2009 1:31 AM
|
|
|
|
|
According to msdn the IRunningObjectTableRegister method takes 4 parameters. See http://msdn.microsoft.com/en-us/library/ms680747(VS.85).aspx
However, the one in System.Runtime.InteropServices.ComTypes only takes 3. See http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comtypes.irunningobjecttable.register.aspx .
Does anyone know if the return value of the .Net Register method is the dwRegister value required for the IRunningObjectTable.Revoke method? The explanation just says the return value is “An HRESULT value that indicates the success or failure of the operation.”
Thanks in advance.
|
|
|
|
|
Sorry, I just saw the "Community Content" bit at the end of the .net article saying the return value is the dwRegister value for the Revoke method.
I have a windows service which instantiates a class and would like to register this object in the ROT. I have found that testing this registry to the ROT works fine when it's done in a standalone exe but not within a windows service. I have read a case for why it doesn't work when in the Windows Service, that there is this flag ROTFLAGS_ALLOWANYCLIENT which you can pass to the Register method to allow any client to see it. Have I understood that the .net's IRunningObjectTable is the one that accepts this flag whereas the Ole32 one does not?
private int myRegisterActiveObject(object pUnk)
{
string sDelim = "!";
string sProgID = "MyNamespace.ClassName";
IBindCtx bc;
Ole32.CreateBindCtx(0, out bc);
IMoniker moniker;
Ole32.CreateItemMoniker(sDelim,sProgID, out moniker);
IRunningObjectTable rot;
bc.GetRunningObjectTable(out rot);
int register = rot.Register((ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT), pUnk, moniker);
return register;
}
I get in the EventLog, "Service cannot be started. System.Runtime.InteropServices.COMException (0x80004015): The class is configured to run as a security id different from the caller (Exception from HRESULT: 0x80004015)..."
The Service is run under account type LocalSystem.
|
|
|
|
|
Notes I've read indicate that I also need to add registry below...
[HKEY_CLASSES_ROOT\APPID\myApp.exe]
"APPID"="{guid}"
But I don't know where i can find this AppId guid. Tried the assembly guid, the Service class's guid, the class guid and still I got the same security erro. I looked in dcomcnfg and my windows service didn't appear there (maybe b/c it failed to start).
|
|
|
|
|
I currently have a program which queries LDAP (Active Directory) and stores that data into a Multi-dimensional array.
I am trying to find another way to store the data that will allow me to manage easier.
My application:
- Runs in System Tray
- Starts at Windows Startup
- Retains Active Directory information in Memory for Quick Lookup
- Only Queries LDAP (AD) at application open
The application is used to quickly retrieve information, send emails, view group memberships.
I have just learned how to use a Dataset and Datatables and tried to store the data into that structure instead of an Array.
There are 18 pieces of data being stored for roughly 400 users so I guess that translates to about 7200 records.
I can store the data into the dataset/datatable, but I'm have a few issues:
Speed - Storing to the Datatable takes 23 seconds, versus 2 seconds for storing to an Array
Processor - While storing to the Datatable the processor is at 15-30%
Memory - Even after flushing the memory using a class I have my application is taking 6MB now instead of roughly 800k-1024k it was before.
My question is this, what is the best way to store the data in memory?
Am I doing anything wrong with the way I'm storing the data to a datatable?
Here is a picture of my application:
http:\\www.jkfweb.com\files\example.jpg
The code is in the following post.
modified on Tuesday, May 12, 2009 1:58 PM
|
|
|
|
|