SQL Server 2005 CLR Integration Problems With Unmanaged Code
Mar 16, 2006
Hi,
With SQL Server 2005 I'm trying to define a CLR integration UDF that calls unmanaged C++ code contained in a .dll.
I have the following two signed assemblies:
1) 'wrapper' - this assembly is basically a wrapper class writen in C++ managed extensions code that calls a legacy library written in unmanaged C++
2) 'provider'- this assembly offers services some of which are contained in the 'wrapper' assembly. This class is written in C# and its assembly is marked as unsafe since it is calling unmanaged code
The problem is that when I run the assembly creation statement:
CREATE ASSEMBLY [Provider]
FROM 'c:DevelopmentProvider.dll'
WITH PERMISSION_SET = UNSAFE;
Produces the error:
Msg 6544, Level 16, State 1, Line 1
CREATE ASSEMBLY for assembly 'Provider' failed because assembly 'wrapper' is malformed or not a pure .NET assembly.
Unverifiable PE Header/native stub.
I understand the nature of the error; wrapper.dll is unsafe unmanaged code and the documentation of CLR integration security states:
"executing from within an UNSAFE assembly can call unmanaged code"
I would think that the 'PERMISSION_SET = UNSAFE' would take care of this situation.
BTW, I can sucessfully call, from a console C# program, the services contained in wrapper.dll, the problem is that I can't get it to work within SQL Server 2005.
Can someone help me out on this?
View 4 Replies
ADVERTISEMENT
Mar 16, 2006
Hi,
With SQL Server 2005 I'm trying to define a CLR integration UDF that calls unmanaged C++ code contained in a .dll.
I have the following two signed assemblies:
1) 'wrapper' - this assembly is basically a wrapper class writen in C++
managed extensions code that calls a legacy library written in
unmanaged C++
2) 'provider'- this assembly offers services some of which are
contained in the 'wrapper' assembly. This class is written in C# and
its assembly is marked as unsafe since it is calling unmanaged code
The problem is that when I run the assembly creation statement:
CREATE ASSEMBLY [Provider]
FROM 'c:DevelopmentProvider.dll'
WITH PERMISSION_SET = UNSAFE;
Produces the error:
Msg 6544, Level 16, State 1, Line 1
CREATE ASSEMBLY for assembly 'Provider' failed because assembly 'wrapper' is malformed or not a pure .NET assembly.
Unverifiable PE Header/native stub.
I understand the nature of the error; wrapper.dll is unsafe unmanaged
code and the documentation of CLR integration security states:
"executing from within an UNSAFE assembly can call unmanaged code"
I would think that the 'PERMISSION_SET = UNSAFE' would take care of this situation.
BTW, I can sucessfully call, from a console C# program, the services
contained in wrapper.dll, the problem is that I can't get it to work
within SQL Server 2005.
Can someone help me out on this?
View 1 Replies
View Related
Jul 11, 2007
I understand there are two ways to run native/unmanaged code in SQL Server 2005 in a .NET stored procedure:
1. using COM objects; or
2. using imported DLL functions.
The thing I'd really like to be able to do, is to use a .NET assembly that either:
1. contains both managed and unmanaged code (i.e. C++); or
2. uses a second assembly that contains both managed and unmanaged code.
SQL Server doesn't allow me to do either, and from what I've read it just isn't possible - however, I can't find this information direct from Microsoft.
I understand the need for marking such assemblies as unsafe, but I just can't understand why mixed assemblies are forbidden, when COM and P/Invoke are allowed from within managed assemblies!
Could someone confirm this? (And maybe put me straight as to the 'why'?!)
Thanks in advance,
Graham
View 8 Replies
View Related
Jan 23, 2006
I have been reading up on everything I can find on this subject and I am not clear if this is allowed within the SQL Server 2005 CLR. My function calls work within a Windows form project, but don't run when invoked from a SQL function. I don't get any errors or warnings when creating the assembly and functions within SQL Server, but when running via a select statement, the spid just hangs and I have to stop & restart the service to kill the process. I have been investigating the security settings for this assembly, but I think I have that covered via the RunTime Security Policy settings in the .NET Framework 2.0 Configuration tool.
Any insights, knowledge, or thoughts would be greatly appreciated.
Barry
View 1 Replies
View Related
Dec 15, 2005
I have an SSIS project created with Beta 2 of VS2005. When I try to open the SSIS Package in the Designer with the final version of VS2005 I get the error message:
Microsoft Visual Studio is unable to load this document
QI for IEnumVARIANT failed on the unmanaged server
Before that happens there is a warning Message: "Document contains one or more extremely long lines of text. These lines will cause the editor to respond slowly when you open the file. Do you still want to open the file?"
When click on Yes to this question the above Error occurs. In the Beta I got the same warning message, but the package was still able to load in the designer.
Is there a way to recover or migrate my package so that I can use it in the final VS2005?
Torsten
View 6 Replies
View Related
Jul 27, 2006
Hi all--I'm trying to convert a function which I inherited from a SQL Server 2000 DTS package to something usable in an SSIS package in SQL Server 2005. Given the original code here:
Function Main()
on error resume next
dim cn, i, rs, sSQL
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
set rs = DTSGlobalVariables("SQLstring").value
for i = 1 to rs.RecordCount
sSQL = rs.Fields(0).value
cn.Execute sSQL, , 128 'adExecuteNoRecords option for faster execution
rs.MoveNext
Next
Main = DTSTaskExecResult_Success
End Function
This code was originally programmed in the SQL Server ActiveX Task type in a DTS package designed to take an open-ended number of SQL statements generated by another task as input, then execute each SQL statement sequentially. Upon this code's success, move on to the next step. (Of course, there was no additional documentation with this code. :-)
Based on other postings, I attempted to push this code into a Visual Studio BI 2005 Script Task with the following change:
public Sub Main()
...
Dts.TaskResult = Dts.Results.Success
End Class
I get the following error when I attempt to compile this:
Error 30209: Option Strict On requires all variable declarations to have an 'As' clause.
I am new to Visual Basic, so I'm on a learning curve here. From what I know of this script:
- The variables here violate the new Option Strict On requirement in VS 2005 to declare what type of object your variable is supposed to use.
- I need to explicitly declare each object, unless I turn off the Option Strict On (which didn't seem recommended, based on what I read).
Given this statement:
dim cn, i, rs, sSQL
I'm looking at "i" as type Integer; rs and sSQL are open-ended arrays, but can't quite figure out how to read the code here:
Set cn = CreateObject("ADODB.Connection")
cn.Open "Provider=sqloledb;Server=<server_name>;Database=<db_name>;User ID=<sysadmin_user>;Password=<password>"
set rs = CreateObject("ADODB.Recordset")
This code seems to create an instance of a COM component, then pass provider information and create the recordset being passed in by the previous task, but am not sure whether this syntax is correct for VS 2005 or what data type declaration to make here. Any ideas/help on how to rewrite this code would be greatly appreciated!
View 7 Replies
View Related
Mar 15, 2008
can anybody help me.
I am getting an sql Server 2005 connection error from c#.net 2005.
following is the error
--------------------------------------------------------------------------------------------
{"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}
---------------------------------------------------------------------------------------------
i have changed the default settings. local and remote connection are enabled.
following are the code i am using in C# .Net 2005
---------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
SqlConnection conn = new SqlConnection("server=localhost; user id= sa; pwd =; Initial Catalog=testdb;");
---------------------------------------------------------------------------------------------------------------
when i connect through the c# wizard, everything is perfect.
thanks in advance
sam alex
View 10 Replies
View Related
Sep 7, 2007
Is it possible to parm in a value to a SSIS
in my SSIS i have a variable;
Name : FileName
Scope : PackageName
Type : String
Value : ""
I have tried adding the following code in my vb.net project ;
pkg.Variables("filename").Value = "C: emp estfile.001"
pkg.execute()
but come up with the following error
A first chance exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll
Public member 'Variables' on type 'IDTSPackage90' not found.
can anyone help ?
View 11 Replies
View Related
Jan 16, 2007
Hi All,
Parameter passing in SSIS 2005 sometimes appears to be a cumbursome task. I have been digging into this topic for quite some time and here i note down some simple steps to demonstrate parameter passing at Package level.
(1) Create a SSIS project using Business Intelligence 2005 Or VS 2005.
(2) Create datasource (.ds) and Data Source View as required.
(3) A default SSIS Package by the name Package.dtsx is created. Double click this and you are shown tabs for Control Flow, Data Flow, Event Handlers, Package Explorer. On the Control Flow, drap and drop Execute SQL Task from Control Flow Items in the toolbar.
(4) Lets now create a variable at Package level. Right click anywhere in the control flow box (not on the Task created in Step 3 above). Click on the Variables on the context menu displayed. Variables window appears on the left of the screen. Click the Add Variable box in this window to create a variable. Name it var1 (or whatever you may like), Scope as Package, DataType as String and Value as MyValue. This is only the default value.
(5) Now let us edit the SQL Task created in Step 3. Double on it, on the General tab you can change its Name, Description. Set ResultSet as None. We shall proceed to execute a stored procedure by name MySPName and pass it a parameter. Set ConnectionType as OLE DB. Select the connection you creates in step 2. Set SQLSourceType as Direct input. SQLStatement as MySPName ? . Note the ? mark after the name of the stored procedure. This is important to accept the variable value (var1) created in Step 4.
(6) Select Parameter Mapping tab now. Click on Add button. Select the Variable Name as User::var1. This is the user created variable of Step 4. Select Direction as Input, DataType as Varchar and Parameter Name as @var1. Click on OK now.
(7) This sets up the basic of parameter passing. Compile the project to verify everything works. Right Click on the SQL Task and select Execute Task. This will execute the package taking default value of the variable. This can be used along with dtexec command with /set option to pass the parameter at command prompt.
View 5 Replies
View Related
Apr 26, 2007
I have an application in C# in which i have few events like download,Import and I have written all the code for that and its working fine but I have to schedule these processes so that I need not to run it manually daily. I am trying to write an Integration services package through which I could handle the required event, without rewriting the whole code.
Please Reply.
Thanks,
Pooja
bajaj.puja@gmail.com
View 4 Replies
View Related
Aug 31, 2006
I am trying to connect a production SQL Server 2005 which is under firewall through an Application written in ASP.Net 1.1 and I get error "SQL Server not available or Access Denied".
I am able to connect to the Server through SQL Mgr also using the same Code and Web.Config file I am able to Connect to the SErver using ASP.Net 2.0.
I am able to run the application for a SQL Server 05 which is in the same domain as of the Application Server.
My Application is not working only when I use ASP.Net 1.1 code for the Remote SQL Server 05 which is under Firewall. But for the same Server ASP.Net 2.0 works fine.
I have searched a lot for the problem and port No, DBNETLIB update is also tried.
Please let me know if anyone has came across such problem or knows the possible cause of the problem.
Sunil.
View 8 Replies
View Related
Aug 18, 2006
Hey,
I need someone to look at a small piece of code and tell me where I'm going wrong in SQL 2005 Server. Where should I post?
Thanks in advance,
Danny
Problem: When I run this I'm told NoOfContractsCount is an invalid column name when I try creating my cusor
USE SLXDEV
SELECT Count(MCS2_CONTRACT.accountid) AS NoOfContractsCOUNT, MCS2_CONTRACT.accountid, CONTACTID
INTO #TempTable
FROM sysdba.MCS2_CONTRACT, CONTACT
WHERE MCS2_CONTRACT.accountid = CONTACT.accountid
GROUP BY MCS2_CONTRACT.accountid, CONTACTID
HAVING Count(MCS2_CONTRACT.accountid) > 1
DECLARE @CountTemp int
DECLARE @accountIDTemp CHAR(12)
DECLARE @ContactIDTemp CHAR(12)
DECLARE @AccountName VARCHAR(128)
DECLARE @LastName VARCHAR(32)
DECLARE @FirstName VARCHAR(32)
DECLARE @WorkPhone VARCHAR(32)
DECLARE @Fax VARCHAR(32)
DECLARE @Mobile VARCHAR(32)
DECLARE @Email VARCHAR(128)
DECLARE @Title VARCHAR(64)
DECLARE @UserField1 VARCHAR(80)
DECLARE @UserField2 VARCHAR(80)
DECLARE @UserField3 VARCHAR(80)
DECLARE searchCursor CURSOR
FOR
SELECT NoOfContractsCOUNT, accountid, ContactID
FROM #TempTable
OPEN searchCursor
FETCH NEXT FROM searchCursor INTO @CountTemp, @accountIDTemp, @ContactIDTemp
While (@@FETCH_STATUS <> -1)
BEGIN
IF (@@FETCH_STATUS <> -2)
BEGIN
PRINT 'GOT HERE'
SELECT @accountIDTemp = AccountID, -- SELECT DISTINCT?
@AccountName = Account, @LastName = LASTNAME, @FirstName = FIRSTNAME,
@WorkPhone = WORKPHONE, @Fax = FAX, @Mobile = MOBILE, @Email = EMAIL,
@Title = TITLE, @UserField1 = USERFIELD1, @UserField2 = USERFIELD2,
@UserField3 = USERFIELD3
FROM CONTACT
WHERE AccountID = @AccountIDTemp
declare @counter int
set @counter = 1
while @counter < @CountTemp
begin
INSERT INTO CONTACT(CONTACTID, ACCOUNTID, ACCOUNT,
FIRSTNAME, LASTNAME, WORKPHONE, FAX, MOBILE, EMAIL,
TITLE, USERFIELD1, USERFIELD2, USERFIELD3)
VALUES
(@ContactIDTemp, @accountIDTemp, @AccountName, @FirstName,
@LastName, @WorkPhone, @Fax, @Mobile, @Email, @Title,
@UserField1, @UserField2, @UserField3)
set @counter = @counter + 1
end
END
END
DROP TABLE #TempTable
View 6 Replies
View Related
Dec 13, 2007
My web project (ASP.NET 2.0 / C#) runs against sql server 2000 and uses the System.Data.SqlClient.using System.Data.SqlClient;
I use System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand to make the connections to the database and do selects and updates. Is it correct to continue to use these against SQL Server 2005? I ask because I made a connection string (outside of .Net) for SqlServer 2005 using the SQL native provider and it had the following - Provider=SQLNCLI.1 and any connection strings I had made (also outside of ASP.NET) fro SQL Server all used Provider=SQLOLEDB.1. This is why I wondered if there is a different SqlClient in .Net 2.0 for SQL Server 2005?
Cheers
Al
View 1 Replies
View Related
Jan 31, 2008
I have an ASP.NET application that access an SQL Server 2005 DB. I develop my C# code using MS Visual Studio. I was happily developing and testing for many months on my machine and then I lost a hard disk. I've replaced the hard disk and reinstalled everything and am getting back to my work. Now though when I try to open the database in my code I get an error saying it was unable to connect to the database perhaps due to SQL Server 2005 not being configured for remote access.
I can see the database using MS SQL Server Management Studio Express and open it. The properties shows the box checked to allow remote access. I restored the database from another hard drive so it should be no different.
I dont' recall having to do anything special the first time to access my database from my code. If I did I forget. What could be causing this? My code hasn't changed so the connection string is the same as is the location of the database.
I can provide more specifics if necessary.
Thanks!
Bob
View 3 Replies
View Related
May 5, 2015
My Execute SQL Task will store the file name into a variable(mFile) of type string datatype.
Now I wanted a script task (C# code) to create a filename from the variable (mFile) value.
Since it is a common issue I tried a lot in the internet but none of the queries worked.
View 10 Replies
View Related
Sep 15, 2015
Before we release an SSIS package into our test environment and then eventually into our production environment, we set the package protection level to "EncryptAllWithPassword"
The "View Code" feature is a nice tool to find things that might be buried in the package somewhere (e.g an complex expression to a variable).
PROBLEM : After one sets the package protection level to "EncryptAllWithPassword", one cannot see the xml source code any longer. It's like compiling and saving cs to the bin. Is their a way to view the code again??
View 2 Replies
View Related
Jul 14, 2006
Hello,
I try to import a directory with pdf-files in the SQL Database.
How can I do this using the Integration Service? I can't
find suitable data sources.
I would be very pleased to get well informed answers.
Yours sincerely
View 1 Replies
View Related
May 12, 2006
Hi,
I wonder if it is possible to use the Express edition of C# to write CLR procedures?
Regards
/Mattias
View 1 Replies
View Related
Feb 26, 2008
I am new user of sql server 2005. I want to integrate my old database which is in sql server 2000.
What steps should I follow for this integration of database..
Plz Help me on this..
Thanks.
~ Charp.
View 7 Replies
View Related
Aug 13, 2007
Hello,
I'm trying to build a integration service package importing data from XML files and directs this data to different MS SQL server 2005 Database tables.
Can someone suggest me what is equivalent(mapping) data type of DT_UI8 in Sql server 2005 for Integration Services.
Or how to consume DT_UI8 fields in SQL server 2005.
View 2 Replies
View Related
Mar 6, 2008
Hi all( Create a VB 2005 SQL Server Project )
i want to Create a Trigger using Managed Code in VB.Net (.NET CLR integration with SQL Server.)Somebody help me.Thanks
View 2 Replies
View Related
Nov 8, 2006
I created an SSIS package for a client that does data importing. When I run the pacakge from Visual Studio there is an error window showing all the errors and warnings. A good example of an error is if the import file is in the wrong format.When there is a error or warning can I write the error log to a file OR notify someone of the errors so they can make corrections and rerun the package OR any ideas that the client can find out what went wrong and then make corrections accordingly? Thanks
View 1 Replies
View Related
May 13, 2015
When I double click on dtsx package , i am getting XML code. I am unable to get the Graphical View. Recently I have installed Visual 2013.
View 6 Replies
View Related
Jun 25, 2015
CREATE TABLE Test
(
EDate Datetime,
Code varchar(255),
Cdate int,
Price int
);
drop table Test
[Code] ....
I have this Query and the below output:
EDate Code CDate Price
2015-06-24 RX 20150701 22
2015-06-24 RX 20150701 28
2015-06-24 RX 20150701 43
[Code] ....
Now the task is to create SSIS package which will create different .txt file for each Code
1) RX20150624.txt
2015-06-24 00:00:00.000 RX 20150701 22
2015-06-24 00:00:00.000 RX 20150701 28
2015-06-24 00:00:00.000 RX 20150701 43
2) NG20150623.txt
2015-06-23 00:00:00.000 NG 20150701 43
3) HO20150624.txt
2015-06-24 00:00:00.000 HO 20150701 43
And so on..
But the requirement is to have a dynamic query where we can have more number of Codes or less number of codes and similarly the package should generate dynamic text files, one .txt file per code. What is the best way to create a package which can meet the above requirement?
View 6 Replies
View Related
Nov 26, 2005
I tried removing and reinstalling SQL Server 2005 Developer Edition for three times, including "all-at-once" component installation and "component-by-component" and I just can't get Integration Services to install.
View 6 Replies
View Related
May 20, 2008
When I install SQL server 2005 and select the option to have Integration Services installed, I cannot see the templates in VS 2005. Is there a way to tell if they have been installed on the harddrive? Is there any way to install them manually?
Thanks,
Carey
View 7 Replies
View Related
Jan 29, 2007
How can we Integrate SQL server 2005 Report builder, Report designer in a custom .Net Application ? . Please Help me.
I want to provide Report Designer, Report builder and Query builder functionalities to my .Net application. How can I Integrate them in my application?
View 3 Replies
View Related
Jul 20, 2007
Hi, I am a newbie in using ASP.NET 2.0 and ADO.NET. I wrote a hangman game and want to record statistics at the end of each game. I will create and update records in the database for each authenticated user as well as a record for the Anonymous, unauthenticated user. After a win or loss has occurred, I want to programmatically use the SQLDataSource control to increment the statistics counters for the appropriate record in the database (note I don't want to show anything or get user input for this function).
I need a VB.NET codebehind example that will show me how I should set up the parameters and update the appropriate record in the database. Below is my code. What happens now is that the program chugs along happily (no errors), but the database record does not actually get updated. I have done many searches on this forum and on the general Internet for programmatic examples of an update sequence of code. If there is a tutorial for this online or a book, I'm happy to check it out.
Any help will be greatly appreciated.
Lambanlaa
CODE - Hangman.aspx.vb
1 Protected Sub UpdateStats()2 Dim playeridString As String3 Dim gamesplayedInteger, gameswonInteger, _4 easygamesplayedInteger, easygameswonInteger, _5 mediumgamesplayedInteger, mediumgameswonInteger, _6 hardgamesplayedInteger, hardgameswonInteger As Int327 8 ' determine whether player is named or anonymous9 If User.Identity.IsAuthenticated Then10 Profile.Item("hangmanplayeridString") = User.Identity.Name11 Else12 Profile.Item("hangmanplayeridString") = "Anonymous"13 End If14 15 playeridString = Profile.Item("hangmanplayeridString")16 17 ' look up record in stats database18 Dim hangmanstatsDataView As System.Data.DataView = CType(statsSqlDataSource.Select(DataSourceSelectArguments.Empty), System.Data.DataView)19 20 gamesplayedInteger = 021 gameswonInteger = 022 easygamesplayedInteger = 023 easygameswonInteger = 024 mediumgamesplayedInteger = 025 mediumgameswonInteger = 026 hardgamesplayedInteger = 027 hardgameswonInteger = 028 29 If hangmanstatsDataView.Table.Rows.Count = 0 Then30 31 ' then create record with 0 values32 statsSqlDataSource.InsertParameters.Clear() ' don't really know what Clear does33 statsSqlDataSource.InsertParameters("playerid").DefaultValue = playeridString34 statsSqlDataSource.InsertParameters("GamesPlayed").DefaultValue = gamesplayedInteger35 statsSqlDataSource.InsertParameters("GamesWon").DefaultValue = gameswonInteger36 statsSqlDataSource.InsertParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger37 statsSqlDataSource.InsertParameters("EasyGamesWon").DefaultValue = easygameswonInteger38 statsSqlDataSource.InsertParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger39 statsSqlDataSource.InsertParameters("MediumGamesWon").DefaultValue = mediumgameswonInteger40 statsSqlDataSource.InsertParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger41 statsSqlDataSource.InsertParameters("HardGamesWon").DefaultValue = hardgameswonInteger42 43 statsSqlDataSource.Insert()44 End If45 46 ' reread the record to get current values47 hangmanstatsDataView = CType(statsSqlDataSource.Select(DataSourceSelectArguments.Empty), System.Data.DataView)48 Dim hangmanstatsDataRow As System.Data.DataRow = hangmanstatsDataView.Table.Rows.Item(0)49 50 ' set temp variables to database values51 gamesplayedInteger = hangmanstatsDataRow("GamesPlayed")52 gameswonInteger = hangmanstatsDataRow("GamesWon")53 easygamesplayedInteger = hangmanstatsDataRow("EasyGamesPlayed")54 easygameswonInteger = hangmanstatsDataRow("EasyGamesWon")55 mediumgamesplayedInteger = hangmanstatsDataRow("MediumGamesPlayed")56 mediumgameswonInteger = hangmanstatsDataRow("MediumGamesWon")57 hardgamesplayedInteger = hangmanstatsDataRow("HardGamesPlayed")58 hardgameswonInteger = hangmanstatsDataRow("HardGamesWon")59 60 ' update stats record61 'statsSqlDataSource.UpdateParameters.Clear()62 'statsSqlDataSource.UpdateParameters("playerid").DefaultValue = playeridString63 64 If Profile.Item("hangmanwinorloseString") = "win" Then65 66 statsSqlDataSource.UpdateParameters("GamesPlayed").DefaultValue = gamesplayedInteger + 167 statsSqlDataSource.UpdateParameters("GamesWon").DefaultValue = gameswonInteger + 168 Select Case Profile.Item("hangmandifficultyInteger")69 Case 170 statsSqlDataSource.UpdateParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger + 171 statsSqlDataSource.UpdateParameters("EasyGamesWon").DefaultValue = easygameswonInteger + 172 Case 273 statsSqlDataSource.UpdateParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger + 174 statsSqlDataSource.UpdateParameters("MediumGamesWon").DefaultValue = mediumgameswonInteger + 175 Case 376 statsSqlDataSource.UpdateParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger + 177 statsSqlDataSource.UpdateParameters("HardGamesWon").DefaultValue = hardgameswonInteger + 178 End Select79 80 81 ElseIf Profile.Item("hangmanwinorloseString") = "lose" Then82 83 statsSqlDataSource.UpdateParameters("GamesPlayed").DefaultValue = gamesplayedInteger + 184 Select Case Profile.Item("hangmandifficultyInteger")85 Case 186 statsSqlDataSource.UpdateParameters("EasyGamesPlayed").DefaultValue = easygamesplayedInteger + 187 Case 288 statsSqlDataSource.UpdateParameters("MediumGamesPlayed").DefaultValue = mediumgamesplayedInteger + 189 Case 390 statsSqlDataSource.UpdateParameters("HardGamesPlayed").DefaultValue = hardgamesplayedInteger + 191 End Select92 End If93 94 statsSqlDataSource.Update()95 96 End Sub97
CODE - Hangman.aspx 1 <asp:SqlDataSource ID="statsSqlDataSource" runat="server" ConflictDetection="overwritechanges"
2 ConnectionString="<%$ ConnectionStrings:lambanConnectionString %>" DeleteCommand="DELETE FROM [Hangman_Stats] WHERE [PlayerID] = @original_PlayerID AND [GamesPlayed] = @original_GamesPlayed AND [GamesWon] = @original_GamesWon AND [EasyGamesPlayed] = @original_EasyGamesPlayed AND [EasyGamesWon] = @original_EasyGamesWon AND [MediumGamesPlayed] = @original_MediumGamesPlayed AND [MediumGamesWon] = @original_MediumGamesWon AND [HardGamesPlayed] = @original_HardGamesPlayed AND [HardGamesWon] = @original_HardGamesWon"
3 InsertCommand="INSERT INTO [Hangman_Stats] ([PlayerID], [GamesPlayed], [GamesWon], [EasyGamesPlayed], [EasyGamesWon], [MediumGamesPlayed], [MediumGamesWon], [HardGamesPlayed], [HardGamesWon]) VALUES (@PlayerID, @GamesPlayed, @GamesWon, @EasyGamesPlayed, @EasyGamesWon, @MediumGamesPlayed, @MediumGamesWon, @HardGamesPlayed, @HardGamesWon)"
4 OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT PlayerID, GamesPlayed, GamesWon, EasyGamesPlayed, EasyGamesWon, MediumGamesPlayed, MediumGamesWon, HardGamesPlayed, HardGamesWon FROM Hangman_Stats WHERE (PlayerID = @playerid)"
5 UpdateCommand="UPDATE [Hangman_Stats] SET [GamesPlayed] = @GamesPlayed, [GamesWon] = @GamesWon, [EasyGamesPlayed] = @EasyGamesPlayed, [EasyGamesWon] = @EasyGamesWon, [MediumGamesPlayed] = @MediumGamesPlayed, [MediumGamesWon] = @MediumGamesWon, [HardGamesPlayed] = @HardGamesPlayed, [HardGamesWon] = @HardGamesWon WHERE [PlayerID] = @original_PlayerID AND [GamesPlayed] = @original_GamesPlayed AND [GamesWon] = @original_GamesWon AND [EasyGamesPlayed] = @original_EasyGamesPlayed AND [EasyGamesWon] = @original_EasyGamesWon AND [MediumGamesPlayed] = @original_MediumGamesPlayed AND [MediumGamesWon] = @original_MediumGamesWon AND [HardGamesPlayed] = @original_HardGamesPlayed AND [HardGamesWon] = @original_HardGamesWon">
6 <DeleteParameters>
7 <asp:Parameter Name="original_PlayerID" Type="String" />
8 <asp:Parameter Name="original_GamesPlayed" Type="Int32" />
9 <asp:Parameter Name="original_GamesWon" Type="Int32" />
10 <asp:Parameter Name="original_EasyGamesPlayed" Type="Int32" />
11 <asp:Parameter Name="original_EasyGamesWon" Type="Int32" />
12 <asp:Parameter Name="original_MediumGamesPlayed" Type="Int32" />
13 <asp:Parameter Name="original_MediumGamesWon" Type="Int32" />
14 <asp:Parameter Name="original_HardGamesPlayed" Type="Int32" />
15 <asp:Parameter Name="original_HardGamesWon" Type="Int32" />
16 </DeleteParameters>
17 <UpdateParameters>
18 <asp:Parameter Name="GamesPlayed" Type="Int32" />
19 <asp:Parameter Name="GamesWon" Type="Int32" />
20 <asp:Parameter Name="EasyGamesPlayed" Type="Int32" />
21 <asp:Parameter Name="EasyGamesWon" Type="Int32" />
22 <asp:Parameter Name="MediumGamesPlayed" Type="Int32" />
23 <asp:Parameter Name="MediumGamesWon" Type="Int32" />
24 <asp:Parameter Name="HardGamesPlayed" Type="Int32" />
25 <asp:Parameter Name="HardGamesWon" Type="Int32" />
26 <asp:Parameter Name="original_PlayerID" Type="String" />
27 <asp:Parameter Name="original_GamesPlayed" Type="Int32" />
28 <asp:Parameter Name="original_GamesWon" Type="Int32" />
29 <asp:Parameter Name="original_EasyGamesPlayed" Type="Int32" />
30 <asp:Parameter Name="original_EasyGamesWon" Type="Int32" />
31 <asp:Parameter Name="original_MediumGamesPlayed" Type="Int32" />
32 <asp:Parameter Name="original_MediumGamesWon" Type="Int32" />
33 <asp:Parameter Name="original_HardGamesPlayed" Type="Int32" />
34 <asp:Parameter Name="original_HardGamesWon" Type="Int32" />
35 </UpdateParameters>
36 <InsertParameters>
37 <asp:Parameter Name="PlayerID" Type="String" />
38 <asp:Parameter Name="GamesPlayed" Type="Int32" />
39 <asp:Parameter Name="GamesWon" Type="Int32" />
40 <asp:Parameter Name="EasyGamesPlayed" Type="Int32" />
41 <asp:Parameter Name="EasyGamesWon" Type="Int32" />
42 <asp:Parameter Name="MediumGamesPlayed" Type="Int32" />
43 <asp:Parameter Name="MediumGamesWon" Type="Int32" />
44 <asp:Parameter Name="HardGamesPlayed" Type="Int32" />
45 <asp:Parameter Name="HardGamesWon" Type="Int32" />
46 </InsertParameters>
47 <SelectParameters>
48 <asp:ProfileParameter Name="playerid" PropertyName="hangmanplayeridString" />
49 </SelectParameters>
50 </asp:SqlDataSource>
View 2 Replies
View Related
Mar 11, 2008
All --
Please help.
I am using managed code in SQL Server 2005 and have a question about stored procedure name qualification.
With a VS.NET 2005 Pro Database project, when I use >Build, >DeploySolution, it works great but my stored procedures are named with qualification using my domainusername.ProcName convention, something like this...
XYZ_TECHKamoskiM.GetData
...when I want them to be named with the dbo.ProcName convention, something like this...
dbo.GetData
...and I cannot see where this can be changed.
Do you happen to know?
Please advise.
(BTW, I have tried going to this setting >Project, >Properties, >Database, >AssemblyOwner, and putting in the value "dbo" but that does not do what I want.)
(BTW, as a workaround, I have simply scripted the procedures, so that I can drop them and then add them back with the right names-- but, that is a bit tedious and wasted effort, IMHO.)
Thank you.
-- Mark Kamoski
View 1 Replies
View Related
Aug 4, 2006
Dear friends,
please help,
let me tell you what happens,
1) first i installed Sql Server 2005 Enterprise Edition, everything was working fine except i was not able to create managed objects from BI, like stored procedures, triggers, UDT, etc etc.
2) so i installed VS.net 2005 complete + Sql Server 2005 Express Edition
now i was able to create stored procedures, triggers, etc etc, i'm talking about the CLR objects, ok, i.e. the managed code, but........ i was only able to do this from Sql Server 2005 Express Edition.
whenever i try to create managed objects CLR like stored procedures and stuff from the Sql Server 2005 Enterprise edition it gives me the following error :
"The Sql Server supplied by these connection properties, does not support managed code, please choose a different server"
please help meeeee.. please please, tell me what's the problem ?
below i'm attaching a screenshot of the error....
View 3 Replies
View Related
Apr 30, 2008
Hello,
I have found code on how to find sql server instances on your local network but my question is. Is there an easy way to find a local copy of SQL Server 2005 and what the name of the instance is. Beacuse the program I am writing will need a sql server installed somewhere on the network then it will allow the user to select either the local copy or a network copy of the sql server
example
on my computer I have SQL Server 2005 express installed and mine is Daniel-LaptopSQLEXPRESS
View 1 Replies
View Related
Jul 13, 2015
Default code page in ETL package is 1252 which will not work if the collation is different e.g in Japanese_CI_AS, it is 932.
My question is how to write a generic ETL package so that it can cater any collation or any code page.
View 5 Replies
View Related