Showing posts with label language. Show all posts
Showing posts with label language. Show all posts

Tuesday, March 27, 2012

Calling Stored Procedure

I am trying to set up a call to a Stored Procedure to do an Insert. Here is my code snippet:

<%@. Page Language="VB" %>
<%@. import Namespace="System" %>
<%@. import Namespace="System.Data.SqlClient" %>
.
.
.
Dim loConn as New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim cmdInsert as New SQLCommand("AdminUser_Insert", loConn)
cmdInsert.CommandType = CommandType.StoredProcedure

Dim InsertForm As New SqlDataAdapter()
InsertForm.InsertCommand = cmdInsert

cmdInsert.Parameters.Add(New SqlParameter("@.RETURN_VALUE", SqlDbType.bigint, 8, "Account_Number"))
cmdInsert.Parameters("@.RETURN_VALUE").Direction = ParameterDirection.ReturnValue
cmdInsert.Parameters.Add(New SqlParameter("@.UserID", SqlDbType.varchar, 50, "UserID"))
cmdInsert.Parameters("@.UserID").Value = Request("UserID")
cmdInsert.Parameters.Add(New SqlParameter("@.Password", SqlDbType.varchar, 32, "Password"))
cmdInsert.Parameters("@.Password").Value = Request("Password")
cmdInsert.Parameters.Add(New SqlParameter("@.First_Name", SqlDbType.varchar, 32, "First_Name"))
cmdInsert.Parameters("@.First_Name").Value = Request("FirstName")
cmdInsert.Parameters.Add(New SqlParameter("@.Middle_Name", SqlDbType.varchar, 32, "Middle_Name"))
cmdInsert.Parameters("@.Middle_Name").Value = Request("MiddleName")
cmdInsert.Parameters.Add(New SqlParameter("@.Last_Name", SqlDbType.varchar, 32, "Last_Name"))
cmdInsert.Parameters("@.Last_Name").Value = Request("LastName")

loConn.Open()
command.ExecuteNonQuery()
loConn.Close()

I get the following error:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30451: Name 'CommandType' is not declared.

This error happens on the line: cmdInsert.CommandType = CommandType.StoredProcedure

Any help would be appreciated,
GregTry importing System.data. I think you're just missing that|||Ugh. That did it. Thank you very much. Been staring at it for a while.

Gregsql

Thursday, March 8, 2012

Callback Function in C#

Hello,
Does anyone know if a C# (or other managed language) DLL can be used as a
callback library for the Callback parameter during setup? I have experience
writing C# applications/libraries but not C++. If it can't be done in C#
then does anyone know of any good C++ templates that I could use as a basis
for creating a callback DLL?
-- Thanks, Jeff
C# would not be an appropriate language for writing a Windows callbackup
function. Actually the best language would be C since it does not mangle the
function names, but C++ will work. The Windows SDK has numerous examples of
how to write a callback function in a DLL. Visual Studio 6 has a wizard for
creating a DLL project and it would be a simple matter of including your
callback declaration and function in the DLL.
Jim
"Jeff B." <jsb@.community.nospam> wrote in message
news:%23Hj9DasJFHA.2980@.TK2MSFTNGP10.phx.gbl...
> Hello,
> Does anyone know if a C# (or other managed language) DLL can be used as a
> callback library for the Callback parameter during setup? I have
> experience writing C# applications/libraries but not C++. If it can't be
> done in C# then does anyone know of any good C++ templates that I could
> use as a basis for creating a callback DLL?
> -- Thanks, Jeff
>

Wednesday, March 7, 2012

Call for Gurus!. converting msSQl schema into standard format (DDL, XML)

Hi,

I am wondering if any of the DB Gurus out there help me finding a way to export mssql SCHEMA (not the actual data) into any standard language, like DDL, XML. At this point converting to XML would be the ideal but I am open to DDL format also.

I would love to hear any feedback about "If this is even possible
or not ?".

thanks,
tinkiSchema can be in a SQL script form. So, ideally this tool that
I am looking for will convery this SQL script info to DDL or
XML.

Thanks in advance,
Tinki|||Have you tried Enterprise Manager?|||DDL, or Data Definition Language, is RDBMS-specific, meaning that it is not like COBOL, VBScript, or XML. DDL for Oracle will look differently than DDL for Sybase for the same set of tables, while certain objects in Oracle will not even be found in Sybase. XML on the other hand is a standard.

Try DBArtisan from Embarcadero. Even though it only has an option "Extract Data as XML", it also allows you to generate the schema portion of your data.|||mySQL and SQL Server have very similar DDLs|||I'm glad|||Originally posted by Paul Young
Have you tried Enterprise Manager?

yes, I have tried Enterprise manager. It lets me export data to SQL script (which is very database specific). what I am looking at something
which can convert this SQL script to something more wodely accepted as a general standard so that my rest of the code does not get too
much database dependent.

tinki|||Originally posted by rdjabarov
DDL, or Data Definition Language, is RDBMS-specific, meaning that it is not like COBOL, VBScript, or XML. DDL for Oracle will look differently than DDL for Sybase for the same set of tables, while certain objects in Oracle will not even be found in Sybase. XML on the other hand is a standard.

Try DBArtisan from Embarcadero. Even though it only has an option "Extract Data as XML", it also allows you to generate the schema portion of your data.

thanks rdjabarov, I will try DBArtisan.

I have tried XMLSPY but it couldn't get to export schema. It was exporting only the data.

tinki.|||Originally posted by rdjabarov
I'm glad

I'm glad your glad!

Should have read tinki's post a little closer, thought he wanted a MSSQL to MYSQL convertion.|||DBArtisan is somewhat pricy, but a must-have tool. Also does lots of other things.|||Originally posted by tinki
what I am looking at something which can convert this SQL script to something more wodely accepted as a general standard so that my rest of the code does not get too much database dependent.
tinki

Are you actually looking for a db-independent db structure, rather than exporting your current db structure? Then, you should take these recommendations into account:

1) use short (table & field) identifiers (Informix 7, for instance, has a maximum length of 18, and Oracle 40)
2) use just characters, digits and the underscore for your identifiers
3) use just ANSI SQL data types, and not, for example, BOOLEAN (BIT)
...
I'm sure that the real gurus in this forum can easely enhance this list.

However, using a data model with no db-specific properties makes it easy to build a db-independent application, with or without a middleware encapsulating db-specific properties.