Optional OLEDB Parameters : Need Help


I am using Oracle 7.3 against SSRS. I have created an inline query with 7 unnamed parameters. I have�named them in SSRS parameters window and selected NULL and ALLOW BLANK check boxes for all the parameters. � a.) What I think should happen is: I should be able to pass the combination of parameters NOT all of them, because I have selected NULL and Blank check boxes. But in my case the query is not giving me any results if I pass 2 of 7 parameters. I can see the results only when I pass all 7 parameters. � Please Help me... � b.) Is there a way I can create a Dynamic WHERE condition using ORACLE 7.3 as database and OUT REF cursor as out parameter for generating parameters.� An Example would be great....... � I am much familar with SQL Server and creting a dynamic query is no problem. Because of this new assignment in Oracle 7.3 I am pulling my hair to solve this perticlaur problem... � Please guys / gals help.. � Thanks, �Deepak

View Answers
Very similar questions



Specifying Optional Parameters When Calling A Sub www.vbforums.com

Hi,I've got a subroutine with some optional parameters, as below:Code:public sub Add(sName as string, optional sAddress as string, optional sTel as string, optional sCountry as string)I've got the required values in variables, so I'm calling it like so:Code:myclass.add strName, strAddress, strTel, strCountryBut the last three strings may be empty, so how do I omit parameters without using a select case?This is an example, my actual code has about 8 optional parameters, that'd be a lot of select case's!I'm not sure if all that made sense, but if you can help, thank you.

Oracle- Error Returning A VarChar From Stored Procedure www.vbcity.com

Hi, When I try to return a varchar from my stored function(Oracle) I get the following error. But when i change the function and return an integer it works fine. Here is the code and the error message. Can anyone point to me what is wrong?.Regards,Sachin.myConnection.Open()Dim selectCmd As New OleDb.OleDbCommand("test2", myConnection)selectCmd.CommandType = CommandType.StoredProcedure Dim ReturnValue As OleDb.OleDbParameter = Selectcmd.Parameters.Add("ReturnValue", OleDb.OleDbType.VarChar)ReturnValue.Direction = ParameterDirection.ReturnValue'Input parametersselectCmd.Parameters.Add(New OleDb.OleDbParameter("@customer_no_", OleDb.OleDbType.VarChar))selectCmd.Parameters("@customer_no_").Direction = ParameterDirection.InputselectCmd.Parameters.Add(New OleDb.OleDbParameter("@credit_card_id_", OleDb.OleDbType.Integer))selectCmd.Parameters("@credit_card_id_").Direction = ParameterDirection.Input'Assign ValuesselectCmd.Parameters("@customer_no_").Value = "1000"selectCmd.Parameters("@credit_card_id_").Value = 1'Execute the functionselectCmd.ExecuteNonQuery()Dim a As String = selectCmd.Parameters("ReturnValue").ValueResponse.Write("Value" + a)myConnection.Close()The error I get isSystem.InvalidOperationException: Parameter 0: 'ReturnValue' of type: String, the property Size has an invalid size: 0 at System.Data.OleDb.OleDbParameter.ValidateParameter() at System.Data.OleDb.OleDbParameter.BindParameter(Int32 i, DBBindings bindings, tagDBPARAMBINDINFO[] bindInfo) at System.Data.OleDb.OleDbCommand.CreateAccessor() at System.Data.OleDb.OleDbCommand.InitializeCommand(CommandBehavior behavior, Boolean throwifnotsupported) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at WebApplication2.WebForm1.DEDR_Update(Object Sender, DataGridCommandEventArgs E) in C:Inetpubwwwrootc$inetpubwwwrootWebApplication2WebForm1.aspx.vb:line 472 If I change the function to make it to return a number it works fine.Dim selectCmd As New OleDb.OleDbCommand("test3", myConnection)selectCmd.CommandType = CommandType.StoredProcedure Dim ReturnValue As OleDb.OleDbParameter = Selectcmd.Parameters.Add("ReturnValue", OleDb.OleDbType.Integer)ReturnValue.Direction = ParameterDirection.ReturnValue'Input ValuesselectCmd.Parameters.Add(New OleDb.OleDbParameter("@customer_no_", OleDb.OleDbType.VarChar))selectCmd.Parameters("@customer_no_").Direction = ParameterDirection.InputselectCmd.Parameters.Add(New OleDb.OleDbParameter("@credit_card_id_", OleDb.OleDbType.Integer))selectCmd.Parameters("@credit_card_id_").Direction = ParameterDirection.Input'Assign ValuesselectCmd.Parameters("@customer_no_").Value = "1000"selectCmd.Parameters("@credit_card_id_").Value = 1'Execute the functionselectCmd.ExecuteNonQuery()Dim a As Integer= selectCmd.Parameters("ReturnValue").Value

Optional Parameter www.xtremevbtalk.com

Is there a way to know if an optional parameter has been passed in the function call or not?For now I use also as an optional parameter a boolean value and my optional parameter that i want and if that boolean is true means that I passed the other option parameter also.Something like: Code:private sub sub1(byval i as integer, optional j as integer, optional passed as boolean) if passed=true then ' do code else ' do code endifend sub' for now I call it with something like thissub1 5,3, true orsub1 5

Passing Arrays To Stored Procedures forums.asp.net

Dear all, i want to know how i can pass multiple values in the form of arrays to a stored procedures. the technique by which i pass multiple values to a stored procedure beginning along with declarations are as follows: Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader() Me.cmdInsSlabHmst = New System.Data.OleDb.OleDbCommand() Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection() Me.cmdInsSlabDMst = New System.Data.OleDb.OleDbCommand() ' 'cmdInsSlabHmst ' Me.cmdInsSlabHmst.CommandText = "PKGSLABHMST.INSSLABHMST" Me.cmdInsSlabHmst.CommandType = System.Data.CommandType.StoredProcedure Me.cmdInsSlabHmst.Connection = Me.OleDbConnection1 Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iSLABDESC", System.Data.OleDb.OleDbType.VarChar, 50)) Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iSLABUNIT", System.Data.OleDb.OleDbType.VarChar, 1)) Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iREMARKS", System.Data.OleDb.OleDbType.VarChar)) Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iSLABFROM", System.Data.OleDb.OleDbType.VarChar)) Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iSLABRATE", System.Data.OleDb.OleDbType.VarChar)) Me.cmdInsSlabHmst.Parameters.Add(New System.Data.OleDb.OleDbParameter("iNOOFRECORDS", System.Data.OleDb.OleDbType.Integer)) ' 'OleDbConnection1 ' Me.OleDbConnection1.ConnectionString = CType(configurationAppSettings.GetValue("ConnectionString", GetType(System.String)), String) 'Passing multiple values to the procedure with the help of ~ sign Dim strCode As String Dim i As Integer 'Dim dblSlabRate As Decimal 'Dim dblSlabFrom As Decimal Dim strSlabRate As String Dim strSlabFrom As String Dim strSlabRateP As String Dim strSlabFromP As String Dim intCntr As Integer 'Me.cmdInsSlabHmst.Parameters("iSLABDESC").Value = txtSlabDesc.Text 'Me.cmdInsSlabHmst.Parameters("iSLABUNIT").Value = ddlSalbUnit.SelectedItem.Value 'Me.cmdInsSlabHmst.Parameters("iREMARKS").Value = txtRemarks.Text 'OleDbConnection1.Open() 'strCode = cmdInsSlabHmst.ExecuteScalar 'OleDbConnection1.Close() For i = 0 To dgSlabDtl.Items.Count - 1 If i = dgSlabDtl.Items.Count - 1 Then 'dblSlabRate = CType(dgSlabDtl.Items(i).FindControl("txtSlabRate"), TextBox).Text 'dblSlabFrom = CType(dgSlabDtl.Items(i).FindControl("txtSlabFrom"), TextBox).Text strSlabRate = CType(dgSlabDtl.Items(i).FindControl("txtSlabRate"), TextBox).Text strSlabFrom = CType(dgSlabDtl.Items(i).FindControl("txtSlabFrom"), TextBox).Text Else 'dblSlabRate = CType(dgSlabDtl.Items(i).FindControl("lblSlabRate"), Label).Text 'dblSlabFrom = CType(dgSlabDtl.Items(i).FindControl("lblSlabFrom"), Label).Text strSlabRate = CType(dgSlabDtl.Items(i).FindControl("lblSlabRate"), Label).Text strSlabFrom = CType(dgSlabDtl.Items(i).FindControl("lblSlabFrom"), Label).Text End If strSlabRateP += strSlabRate & "~" strSlabFromP += strSlabFrom & "~" intCntr += 1 'If dblSlabRate <> "" And dblSlabFrom <> "" Then 'InsDtl(strCode, dblSlabFrom, dblSlabRate) 'End If Next If strSlabRateP <> "" And strSlabFrom <> "" Then With cmdInsSlabHmst .Parameters("iSLABDESC").Value = UCase(txtSlabDesc.Text) .Parameters("iSLABUNIT").Value = ddlSalbUnit.SelectedItem.Value .Parameters("iREMARKS").Value = txtRemarks.Text .Parameters("iSLABFROM").Value = strSlabFromP .Parameters("iSLABRATE").Value = strSlabRateP .Parameters("iNOOFRECORDS").Value = intCntr End With OleDbConnection1.Open() cmdInsSlabHmst.ExecuteNonQuery() OleDbConnection1.Close() End If to the insert procedure i am passing multiple values with the help of ~ sign and in the procedure the individual values are separated by identifying the position of ~ sign and the no. of records which have been passed. For which a complicated stored procedure has been written. i want to pass multiple values in an array, so that my stored procedure becomes simple and runs faster. So, if someone tells me how to pass arrays to a stored procedure (with code example), it will be of real help. regards subhajit

.net MVC Routing To Controller With Optional Parameters stackoverflow.com

I have a controller method that is called with many different combinations of URL's. To overcome issue i am using optional parameters.here is my controller method signature...public ActionResult localMembersSearch(string Gender, string calling, [Optional]string Region, [Optional]string County, [Optional]string Town, [Optional]string queryvalues)the first two parameters are not optional but always expect

User-defined Type Cannot Be An Optional Parameter www.xtremevbtalk.com

Well this is a pickle.I have a function with these parameters:Code:Public Function TriggerEvent(Optional sTitle As String, Optional sInfo As String, Optional iChoices As Integer, Optional sChoiceTitles As Choices, Optional iResponse As Integer = 999)'....Public Type Choices sChoices(0 To 5) As StringEnd TypeThe reason I defined sChoiceTitles as a userdefined type is because the number of elements in that depends on the value of iChoices.Now, this code *should* work, but VB won't let you pass a user-defined type array as an optional parameter.Can someone think of an alternate way to make this work?

Optional Parameter Addition To A Colletion stackoverflow.com

am to add optional parameter to pass these in a method the parameter may vary every time.And i need to pass these parameter to a method, so my question is how should i add these optional parameter to a collection and what kind of collection object should i use and how should i use that.

Checking If An Optional Parameter Has Been Passed Or Not www.xtremevbtalk.com

HiI want to check if an optional parameter has been passed or not within the function definition as I cannot predict the calling function is passing the optional parameter or not.For example:Private Function returnContents(Optional ByVal strFile As String) As String 'Here can I just check the optional variable literally? 'or is there any other way, special keyword/usage to check if the specified 'parameter did have been passed or not 'Here the following will use the default property FullFileName if another 'file name has not been passed along If Len(strFile) < 1 Then strFile = FullFileName End If Open strFile For Input As #1 returnContents = Input(LOF(1), 1) Close #1End FunctionthnxPye

Need Help With Inserting Into A SQL Db www.xtremevbtalk.com

Hi,Sorry but I am a total newbie to VB and database programming....What I needed help with is inserting into a database. I have successfully retreived information from the database using this code:Code:oleDbDataAdapter1.SelectCommand.Parameters["simi"].Value = simiFind.Text;DataSet.Clear();oleDbDataAdapter1.Fill(DataSet);if(this.BindingContext[DataSet, "persona"].Count == 0){ MessageBox.Show("Það er enginn með þetta númer " + simiFind.Text); simiFind.Focus();}I got my oleDbDataAdapter commands generated for me by VB they look like this:Code:// oleDbInsertCommand1this.oleDbInsertCommand1.CommandText = "INSERT INTO persona(nafn, heimilisfang, simi) VALUES (?, ?, ?); SELECT nafn, heimilisfang, simi FROM persona WHERE (simi = ?)";this.oleDbInsertCommand1.Connection = this.oleDbConnection1;this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("nafn", System.Data.OleDb.OleDbType.VarChar, 20, "nafn"));this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("heimilisfang", System.Data.OleDb.OleDbType.VarChar, 20, "heimilisfang"));this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("simi", System.Data.OleDb.OleDbType.Integer, 4, "simi"));this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Select_simi", System.Data.OleDb.OleDbType.Integer, 4, "simi"));// oleDbSelectCommand1this.oleDbSelectCommand1.CommandText = "SELECT nafn, heimilisfang, simi FROM persona WHERE (simi = ?)";this.oleDbSelectCommand1.Connection = this.oleDbConnection1;this.oleDbSelectCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("simi", System.Data.OleDb.OleDbType.Integer, 4, "simi"));But I can't use these InsertCommands or at least can't figure out how to ... Could someone take time and explain to me what I am doing wrong...This is how I tried to use it:Code:oleDbDataAdapter1.InsertCommand.Parameters[0].Value = nafnAdd.Text;oleDbDataAdapter1.InsertCommand.Parameters[1].Value = heimiliAdd.Text;oleDbDataAdapter1.InsertCommand.Parameters[2].Value = simiAdd.Text;int rows = this.oleDbDataAdapter1.Update(DataSet.persona);PS. persona is the table I am working with...It has three columns: nafn, heimilisfang, simi...Thank you for your time,ZiqXx

SQL Server :: How To Create A Dynamic Stored Procedure forums.asp.net

I want to create a dynamic stored procedure. How can I create one? A procedure which can be called with or without parameters passing (something like optional parameter. but don't know how to use optional parameters. plz tell me how to create a stored procedure with optional parameters, and also if it is the only way to create the dynamic stored procedures.)


PHP5 Factory Method With Dynamic Parameters? www.phpfreaks.com

Create an object that givs 1 entry point for the creation of all objects, and act's as the API for all object calls.Problem:All (NON-Singleton) objects that need a __construct method must have  ONLY optional parameters.Ex: class MySQL { [code]....... Where the factory not only creates the object "MySQL" but it also will pass a given set of parameters to MySQL's constructor. This can almost be accomplished with call_user_func_array the only issue is that you have to create the object prior to using call_user_func_array which means the parameter's of MySQL's constructor must be optional.

How Can I Map Oledb Parmeters Into A Access Select Query www.xtremevbtalk.com

PARAMETERS cod Text ( 255 ), nam Text ( 255 ), num Text ( 255 ), addr Text ( 255 );SELECT [INTERNATIONAL RATES].[COUNTRY CODE] AS CountryCode, [INTERNATIONAL RATES].[COUNTRY NAME], INTERNATIONALSUBSCRIBER.NAME AS InternationalContactName, INTERNATIONALSUBSCRIBER.Address AS InternationalContactAddress, INTERNATIONALSUBSCRIBER.ContactNumber AS InternationalContactNumberFROM [INTERNATIONAL RATES] INNER JOIN INTERNATIONALSUBSCRIBER ON [INTERNATIONAL RATES].[COUNTRY CODE] = INTERNATIONALSUBSCRIBER.COUNTRYCODEWHERE ((([INTERNATIONAL RATES].[COUNTRY CODE])=[cod]) AND ((INTERNATIONALSUBSCRIBER.NAME) Like "*" & [nam] & "*") AND ((INTERNATIONALSUBSCRIBER.Address) Like "*" & [addr] & "*") AND ((INTERNATIONALSUBSCRIBER.ContactNumber) Like "*" & [num] & "*"));this is an access query.when i ran it from access it worked fine.To work fine this query must be given the value of cod parameter rest can be left emptyi.ecod=some stringnam=can be emptynum=can be emptyaddr =can be emptynow i have declared four parameters.Ada.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@cod", Data.OleDb.OleDbType.WChar, 13)).Ada.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@nam", Data.OleDb.OleDbType.WChar, 30, ParameterDirection.Input)).Ada.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@num", Data.OleDb.OleDbType.WChar, 30)).Ada.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@addr", Data.OleDb.OleDbType.WChar, 70))here txt means a text box,cmd combo box ds is a datasetnow values to these parameters are given .Ada.SelectCommand.Parameters(0).Value = Ds.Tables("Country").Rows(CmbCountryNameCode.SelectedIndex).Item(0).To String If ChkName.Checked = True Then .Ada.SelectCommand.Parameters("@nam").Value = TxtName.Text.ToString MsgBox(.Ada.SelectCommand.Parameters("@nam").Value, MsgBoxStyle.Critical) End If If ChkAddress.Checked = True Then .Ada.SelectCommand.Parameters("@num").Value = TxtNumber.Text End If If ChkNumber.Checked = True Then .Ada.SelectCommand.Parameters("@addr").Value = TxtAddress.Text End Ifnow when i execute a fill .Ada.Fill(.Ds, "InternationalNumbers1")no records are there in InternationalNumbers1 but when i run query in access based on same values it returns records.i think the other three parameters are not mapping properly can some one help

SQL Server :: How To Execute Stored Procedure From Front End Without Passing Values To Optional Para... forums.asp.net

In my stored procedure I have declared some parameters as NULL values(Optional Parameters). In my C#.NET code I didn't use the parameters to pass values to Stored Procedure's NULL Parameters. So I am getting Exception. I don't want to pass parameters from my code.Because I have declared 30 parameters in my Stored Procedure as NULL values. Is there any other way to execute Stored Procedure from Front End without passing values to Optional Parameters in SQL stored procedure?

Htmlentities Et Al.: Relationship Between Quote_style And Charset Parameters (was: Character Switch) bytes.com

The Manual expresses the parameters of htmlentities as: string string [, int quote_style [, string charset]] http://www.php.net/manual/en/function.htmlentities.php The meaning is unambiguous: the first parameter, "string", must be present; the second parameter, "quote_style", is optional; and the final parameter, "charset", is optional too, but its presence requires the, prima facie, ought-to-be dispensable second parameter. Why does the existence of the charset parameter depend on the existence of the quote_style parameter? What's the connection?

ActionScript 3.0 :: Set Optional Parameters In A Custom Class? www.kirupa.com

Im coding in AS3, and i want to make a class that will recieve optional parameters, but i dont know how to identify these parameters as optional. I tried writing Code: public function mydate([language:String]):void{ like Adobe identifies optional parameters, but it doesnt work

SqlDateTime Overflow forums.asp.net

I've seen a few comments on this error and they've all been basically "You're passing a bad date time". I don't think that's what's happening in my case though. I'm trying to write a record to my SQL database using a business logic layer class that writes the record with a stored procedure. Here's the codebehind on the page: Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)'Create New User UsersBLL.NewUser(txtFirstName.Text, _ txtLastName.Text, _ txtPhone1.Text, _ ddlOffice.SelectedIndex, _ lblManager.Text, _ lblManagerAlt.Text, _ txtDepartment.Text, _ cbxNewPosition.Checked, _ cbxContractor.Checked, _ Calendar1.SelectedDate.ToString, _ txtJobTitle.Text, _ ddlFunctionCodes.SelectedIndex) End Sub  Here's the BLL function that I'm calling:    Public Shared Function NewUser(ByVal UsersNameFirst As String, _                    ByVal UsersNameLast As String, _                    ByVal UsersPhone1 As String, _                    ByVal OfficesID As Int32, _                    ByVal UsersID_Manager As Int32, _                    ByVal UsersID_ManagerAlt As Int32, _                    ByVal UsersDepartment As String, _                    ByVal UsersNewPosition As Boolean, _                    ByVal UsersContractor As Boolean, _                    ByVal UsersStartDate As DateTime, _                    ByVal UsersJobTitle As String, _                    ByVal FunctionCodesID As Int32, _                    Optional ByVal UsersGSN As String = Nothing, _                    Optional ByVal UsersEmail As String = Nothing, _                    Optional ByVal UsersNameMiddle As String = Nothing, _                    Optional ByVal UsersKnownAs As String = Nothing, _                    Optional ByVal UsersPhone2 As String = Nothing, _                    Optional ByVal UsersPhoneMobile1 As String = Nothing, _                    Optional ByVal UsersPhoneMobile2 As String = Nothing, _                    Optional ByVal UsersSSN As String = Nothing, _                    Optional ByVal UsersContractType As String = Nothing, _                    Optional ByVal UsersContractAgency As String = Nothing, _                    Optional ByVal UsersEndDate As DateTime = Nothing, _                    Optional ByVal UsersCompanyCode As String = Nothing, _                    Optional ByVal UsersCostCenter As String = Nothing, _                    Optional ByVal UsersRole As String = Nothing, _                    Optional ByVal StatusesID As Int32 = Nothing)        Dim dbConnection As SqlConnection, Command As SqlCommand        dbConnection = New SqlConnection(DBConnectionString)        dbConnection.Open()        Command = New SqlCommand("EXECUTE NewUser", dbConnection)        Command.Connection = dbConnection        Command.CommandText = "NewUser"        Command.CommandType = Data.CommandType.StoredProcedure        Command.Parameters.Add(New SqlParameter("@UsersNameFirst", UsersNameFirst))        Command.Parameters.Add(New SqlParameter("@UsersNameLast", UsersNameLast))        Command.Parameters.Add(New SqlParameter("@UsersPhone1", UsersPhone1))        Command.Parameters.Add(New SqlParameter("@OfficesID", OfficesID))        Command.Parameters.Add(New SqlParameter("@UsersID_Manager", UsersID_Manager))        Command.Parameters.Add(New SqlParameter("@UsersID_ManagerAlt", UsersID_ManagerAlt))        Command.Parameters.Add(New SqlParameter("@UsersNewPosition", UsersNewPosition))        Command.Parameters.Add(New SqlParameter("@UsersContractor", UsersContractor))        Command.Parameters.Add(New SqlParameter("@UsersStartDate", UsersStartDate))        Command.Parameters.Add(New SqlParameter("@UsersJobTitle", UsersJobTitle))        Command.Parameters.Add(New SqlParameter("@FunctionCodesID", FunctionCodesID))        Command.Parameters.Add(New SqlParameter("@UsersGSN", UsersGSN))        Command.Parameters.Add(New SqlParameter("@UsersEmail", UsersEmail))        Command.Parameters.Add(New SqlParameter("@UsersNameMiddle", UsersNameMiddle))        Command.Parameters.Add(New SqlParameter("@UsersKnownAs", UsersKnownAs))        Command.Parameters.Add(New SqlParameter("@UsersPhone2", UsersPhone2))        Command.Parameters.Add(New SqlParameter("@UsersPhoneMobile1", UsersPhoneMobile1))        Command.Parameters.Add(New SqlParameter("@UsersPhoneMobile2", UsersPhoneMobile2))        Command.Parameters.Add(New SqlParameter("@UsersSSN", UsersSSN))        Command.Parameters.Add(New SqlParameter("@UsersContractType", UsersContractType))        Command.Parameters.Add(New SqlParameter("@UsersContractAgency", UsersContractAgency))        Command.Parameters.Add(New SqlParameter("@UsersEndDate", UsersEndDate))        Command.Parameters.Add(New SqlParameter("@UsersCompanyCode", UsersCompanyCode))        Command.Parameters.Add(New SqlParameter("@UsersCostCenter", UsersCostCenter))        Command.Parameters.Add(New SqlParameter("@UsersCostCenter", UsersCostCenter))        Command.Parameters.Add(New SqlParameter("@UsersRole", UsersRole))        Command.Parameters.Add(New SqlParameter("@StatusesID", StatusesID))        Return Command.ExecuteScalar()        dbConnection.Close()     Here's the stored procedure I'm running in SQL:  ( @UsersGSNvarchar(20) = Nothing, @UsersNameFirstvarchar(20), @UsersNameMiddlevarchar(20) = Nothing, @UsersNameLastvarchar(20), @UsersKnownAsvarchar(20) = Nothing, @UsersPhone1varchar(50), @UsersPhone2varchar(50) = Nothing, @UsersPhoneMobile1varchar(20) = Nothing, @UsersPhoneMobile2varchar(20) = Nothing, @UsersEmailvarchar(50) = Nothing, @OfficesIDint, @UsersDepartmentvarchar(50), @UsersSSNvarchar(5) = Nothing, @UsersNewPositionbit, @UsersContractorbit, @UsersContractTypevarchar(20) = Nothing, @UsersContractAgencyvarchar(50) = Nothing, @UsersStartDatedatetime, @UsersEndDatedatetime = Nothing, @UsersJobTitlevarchar(50), @FunctionCodesIDint, @UsersCompanyCodevarchar(20) = Nothing, @UsersCostCentervarchar(20) = Nothing, @UsersID_Managerint, @UsersID_ManagerAltint, @UsersRolevarchar(20) = "User", @StatusesIDint = 1 ) AS SET NOCOUNT OFF; INSERT INTO [Users] (UsersGSN, UsersNameFirst, UsersNameMiddle, UsersNameLast, UsersKnownAs, UsersPhone1, UsersPhone2, UsersPhoneMobile1, UsersPhoneMobile2, UsersEmail, OfficesID, UsersDepartment, UsersSSN, UsersNewPosition, UsersContractor, UsersContractType, UsersContractAgency, UsersStartDate, UsersEndDate, UsersJobTitle, FunctionCodesID, UsersCompanyCode, UsersCostCenter, UsersID_Manager, UsersID_ManagerAlt, UsersRole, StatusesID) VALUES (@UsersGSN, @UsersNameFirst, @UsersNameMiddle, @UsersNameLast, @UsersKnownAs, @UsersPhone1, @UsersPhone2, @UsersPhoneMobile1, @UsersPhoneMobile2, @UsersEmail, @OfficesID, @UsersDepartment, @UsersSSN, @UsersNewPosition, @UsersContractor, @UsersContractType, @UsersContractAgency, @UsersStartDate, @UsersEndDate, @UsersJobTitle, @FunctionCodesID, @UsersCompanyCode, @UsersCostCenter, @UsersID_Manager, @UsersID_ManagerAlt, @UsersRole, @StatusesID);     Seems about as simple as it can get to me. UsersStartDate is a datetime (which I'm picking from a calendar control on the web page) and it's passing (for example) "08/01/2007 12:00:00 AM". I've debugged and that's the value being passed. Now when I go to my DB and write a simple insert query and insert exactly that date, it works fine. Maybe my development machine date settings are changing it somehow before it sends to the DB? Also I'm pretty sure there's a lot of redundant passing of all those vars but I'm brand new to tiered apps and just learning. If there's a simpler way, feel free to enlighten me. :)

SQL Server Stored Proc Called With ADO - Dates Off By 2 Days www.vbcity.com

I have been searching for an answer to this, but can't seem to find anything.When I pass a date parameter (parm name is "EventDate") through and ADO command object to a stored procedure in SQL Server 2000, the date is two days earlier than what is entered in the UI. What am I doing wrong? Thanks for the help. Below is the code for the VB part:Code:Public Function Insert(ByRef lngControlID As Long, ByRef lngConcurrencyID As Long, _ ByVal lngRailcarID As Long, ByVal dteEventDate As Date, ByVal dteEventTime, _ ByVal strEvent As String, ByVal strLE As String, ByVal strCity As String, _ ByVal strState As String, Optional ByVal strDestCity As String = "NULL", _ Optional ByVal strDestState As String = "NULL", Optional ByVal strRR As String = "NULL", _ Optional strComments As String = "NULL", _ Optional ByVal dteImported As Date = #7/4/1776#, Optional ByVal strSource As String = "NULL", _ Optional ByVal fUpdateLast As Boolean = False, Optional ByVal strETACity As String = "NULL", _ Optional ByVal strETAState As String = "NULL", Optional ByVal strETAEvent As String = "NULL", _ Optional ByVal dteETA As Date = #7/4/1776#, Optional ByVal strETAType As String = "NULL", _ Optional ByVal strTrainID As String = "NULL") As Boolean            ' Enable error trap    On Error GoTo HandleErrors        Dim lngErr As Long    Dim strErrDesc As String    Dim strErrSrc As String    Dim cnn As adodb.Connection    Dim cmd As adodb.Command    Dim parm As adodb.Parameter    Set cnn = New adodb.Connection    cnn.Open GetCnnString()    Set cmd = New adodb.Command        ' Build command    Set cmd = New adodb.Command    cmd.ActiveConnection = cnn    cmd.CommandText = "procInsertSighting"    cmd.CommandType = adCmdStoredProc        ' Establish parameters to pass to the command    Set parm = cmd.CreateParameter("RailcarID", adInteger, adParamInput, , lngRailcarID)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("EventDate", adDBDate, adParamInput, , dteEventDate)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("EventTime", adDBDate, adParamInput, , dteEventTime)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("Event", adVarChar, adParamInput, 3, strEvent)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("LEStatus", adVarChar, adParamInput, 1, strLE)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("City", adVarChar, adParamInput, 9, strCity)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("State", adVarChar, adParamInput, 2, strState)    cmd.Parameters.Append parm    If strDestCity <> "NULL" Then        Set parm = cmd.CreateParameter("DestCity", adVarChar, adParamInput, 9, strDestCity)    Else        Set parm = cmd.CreateParameter("DestCity", adVarChar, adParamInput, 9, Null)    End If    cmd.Parameters.Append parm    If strDestState <> "NULL" Then        Set parm = cmd.CreateParameter("DestState", adVarChar, adParamInput, 2, strDestState)    Else        Set parm = cmd.CreateParameter("DestState", adVarChar, adParamInput, 2, Null)    End If    cmd.Parameters.Append parm    If strRR <> "NULL" Then        Set parm = cmd.CreateParameter("Railroad", adVarChar, adParamInput, 4, strRR)    Else        Set parm = cmd.CreateParameter("Railroad", adVarChar, adParamInput, 4, Null)    End If    cmd.Parameters.Append parm    If strTrainID <> "NULL" Then        Set parm = cmd.CreateParameter("TrainID", adVarChar, adParamInput, 6, strTrainID)    Else        Set parm = cmd.CreateParameter("TrainID", adVarChar, adParamInput, 6, Null)    End If    cmd.Parameters.Append parm    If strComments <> "NULL" Then        Set parm = cmd.CreateParameter("Comments", adVarChar, adParamInput, 5, strComments)    Else        Set parm = cmd.CreateParameter("Comments", adVarChar, adParamInput, 5, Null)    End If    cmd.Parameters.Append parm    If dteImported <> #7/4/1776# Then        Set parm = cmd.CreateParameter("Imported", adDBDate, adParamInput, , dteImported)    Else        Set parm = cmd.CreateParameter("Imported", adDBDate, adParamInput, , Null)    End If    cmd.Parameters.Append parm    If strSource <> "NULL" Then        Set parm = cmd.CreateParameter("Source", adVarChar, adParamInput, 4, strSource)    Else        Set parm = cmd.CreateParameter("Source", adVarChar, adParamInput, 4, Null)    End If    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("Modify", adDBDate, adParamInput, , Null)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("WhoModify", adVarChar, adParamInput, 4, Null)    cmd.Parameters.Append parm    If dteETA <> #7/4/1776# Then        Set parm = cmd.CreateParameter("ETA", adDBDate, adParamInput, , dteETA)    Else        Set parm = cmd.CreateParameter("ETA", adDBDate, adParamInput, , dteETA)    End If    cmd.Parameters.Append parm    If strETAType <> "NULL" Then        Set parm = cmd.CreateParameter("ETAType", adVarChar, adParamInput, 1, strETAType)    Else        Set parm = cmd.CreateParameter("ETAType", adVarChar, adParamInput, 1, Null)    End If    cmd.Parameters.Append parm    If strETACity <> "NULL" Then        Set parm = cmd.CreateParameter("ETACity", adVarChar, adParamInput, 9, strETACity)    Else        Set parm = cmd.CreateParameter("ETACity", adVarChar, adParamInput, 9, Null)    End If    cmd.Parameters.Append parm    If strETAState <> "NULL" Then        Set parm = cmd.CreateParameter("ETAState", adVarChar, adParamInput, 2, strETAState)    Else        Set parm = cmd.CreateParameter("ETAState", adVarChar, adParamInput, 2, Null)    End If    cmd.Parameters.Append parm    If strETAEvent <> "NULL" Then        Set parm = cmd.CreateParameter("ETAEvent", adVarChar, adParamInput, 3, strETAEvent)    Else        Set parm = cmd.CreateParameter("ETAEvent", adVarChar, adParamInput, 3, Null)    End If    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("SightingID", adInteger, adParamOutput, , lngControlID)    cmd.Parameters.Append parm    Set parm = cmd.CreateParameter("ConcurrencyID", adInteger, adParamOutput, , lngConcurrencyID)    cmd.Parameters.Append parm        ' Execute the command    cmd.Execute        ' Exit    Set parm = Nothing    Set cmd = Nothing    If cnn.State = adodb.adStateOpen Then cnn.Close    Set cnn = Nothing    Exit Function    HandleErrors:    ' Grab Access/VBA error    lngErr = Err.Number    strErrDesc = Err.Description    strErrSrc = Err.Source        ' If ADO Error available grab the first    ' one in the collection.    If cnn.Errors.Count > 0 Then        lngErr = cnn.Errors(0).NativeError        strErrDesc = cnn.Errors(0).Description        strErrSrc = cnn.Errors(0).Source    End If                    Err.Raise lngErr, "Sighting.Insert (Prior: " & strErrSrc & ")", strErrDesc        Exit Function    End FunctionWelcome to vbCity! With that much code, please use the code tags.And, please highlight the lines that are causing you problems.     Edited by - Geof on 7/27/2006 5:50:23 PM

How Do You Declare A Function And Have Optional Parameters? www.vbforums.com

I would like to have a function that can perform one task with two parameters supplied and another task when four parameters are supplied. The same function should work with either two or four parameters. In other words, the second two parameters are optional. How can I make the function recognize that the second two are optional? If I just decalare the variables in the function declaration and I pass only two parameters, I get an error because the second two parameters aren't specified.

Property Get And Set(NM Resolved Stupid Mistake) www.vbforums.com

Hello all I have this property get and set in a class for a DLL I'm creating.VB Code:Public Property Set Font(nFont As CellFont)    FontSettings = nFontEnd Property Public Property Get Font() As CellFont    Font = FontSettingsEnd Property It tells me when I try to compile the DLL this:Compile Error:Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameterNow as you can clearly see definitions are the same both are of type cellfont, I have no optional parameters, no arrays are being passed and I'm not even using a Property Set statement.So where the heck is the error?Thanks for any help,Steven

Using Optional Parameters (was: Newbie Needs Help) forums.devshed.com

I am really new to VB and I have a question about optional parameters. When is the use of Optional Parameters beneficial in the development process?Any help would be appreciated.

DataSource Controls :: Getting A Syntax Error forums.asp.net

Dim connStr As String = " Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=W:PatioOrderApp_DataPatio.mdb" Dim con As New OleDb.OleDbConnection(connStr) Dim instr As String = " INSERT INTO tOrders([first_name],[last_name],[order],[comment]) Valuse(?,?,?,?)" If IsValid Then Using con Using cmd As New OleDb.OleDbCommand(instr, con) cmd.CommandType = CommandType.Text cmd.Parameters.AddWithValue("first_name", DBNull.Value) cmd.Parameters.AddWithValue("last_name", DBNull.Value) cmd.Parameters.AddWithValue("order", DBNull.Value) cmd.Parameters.AddWithValue("comment", menuDrinks.SelectedItem.ToString) con.Open() cmd.ExecuteNonQuery() End Using End Using con.Close() End If

Calling A ADO Object Method Has Optional Parameters? stackoverflow.com

A basic set of functions done for accessing ADO through PHP.when trying to execute a stored procedure with the adExecuteNoRecords option set for $cmd->Execute(,,adExecuteNoRecords);.The first two parameters, new VARAINT(), new VARIANT(null), new VARIANT(VT_EMPTY), etc.a "Cannot pass parameter 1 by reference" or a com_exception of Type Mismatch, and ->Execute(,,adExecuteNoRecords) doesn't pass the PHP parsing.PHP when calling a COM object's method that has optional parameters, Set the beginning parameter's to nothing?calling a ADO object method has optional parameters?

Private Object Modules Cannot Be Used In Public Object Modules As Parameters Or.. ??? www.vbforums.com

---------------------------Microsoft Visual Basic---------------------------Compile error:Private object modules cannot be used in public object modules as parameters or return types for public procedures, as public data members, or as fields of public user defined types ---------------------------OK Help ---------------------------this is the line it gives me the errorPublic Sub Initialise(targetframe As Form, Optional window As Integer = 0, Optional width As Integer = 640, Optional height As Integer = 480)what is that all about? it is in a ACTIVE X controll :S

Confusion Regarding The Open() Statement www.codeguru.com

THe MSDN shows this for Open()Enables input/output (I/O) to a file.SyntaxOpen pathname For mode [Access access] [lock] As [#]filenumber [Len=reclengthNote the optional # for the Filenumber param.There is no explanation in the help for this optional parameterWhat is the # for and when should it be used or not used?The Get() statement also uses # as an optional parameter, agian with no explanation.Thanks

Insert Data To Optional Fields? social.msdn.microsoft.com

I have some fix fields in my database but user can add some another fields to my database if s/he needs. How can I insert data to this kind of fields if there are? For fixed fields I have used the follow cods Dim rs As New OleDb.OleDbCommand( "INSERT INTO Wind_Parameters (ID, Name, CrX, CrY) VALUES ('" & ID & [Code].... But I can't add optional fields to this code. I think I should use UPDATE syntax for fill optional fields after running this cod but I couldn't find correct syntax for it in visual basic 2010

VS 2010 Optional And Named Parameters In An Attribute? www.vbforums.com

I have a custom Attribute class where the constructor takes one fixed parameter and two optional parameters. It is my understanding that one can supply one or more optional parameters by using 'named parameters' such as this: Private Sub CallMethod() Me.OptionalMethod(-1, z:=1) End Sub [code].... Well, I thought, perhaps Attributes don't support named parameters. I know they can behave a little weird (they don't support all types in their arguments for example I think), so I thought little of it.But then... I noticed something else. If you take a look at my code of the attribute class again. Notice that I am using an attribute on that class as well... And what do you know: named parameters. Working just fine... The AttributeUsage attribute has the exact same configuration: one fixed parameter and two optional parameters. I seem to be able to call them using named parameters just fine, where I cannot call my own attribute constructor with named parameters...

Determine If Optional Argument Passed www.xtremevbtalk.com

Hello!I have a function which supports optional parameters, too. The value of the parameter is Integer.Now my question: is it possible to determine if the optional parameter was given, without using Code:If Parameter = 0Thank you in advance.

DataSource Controls :: Want To Verify / To Omit Parameters When Calling SP From ..NET With Optional ... forums.asp.net

Is it possible to omit parameters when calling SP from ASP.NET with optional parameters? I have a vague feeling, that I always have to supply all parameters, even optional.By supply, I mean I have to define them as parameters.

Multivalue Optional Parameters : Report Builder social.msdn.microsoft.com

Hi All, Is there any way to make Multivalue parameter ( list parameter) in Report builder as optional ? I was able to achieve optional functionalitiy for parameter is single value but not able to with respect to multivalue parameters An early response is highly appreciated � Thanks �

Could I Know The Value Of Optional Parameters? www.codeguru.com

The Documents object of Microsoft Word has provided the following method to open a document: Open( FileName, ConfirmConversions, ....... ) If I call this method in VB, I only need to pass the first parameter. All parameters after "FileName" are optional. But if I call this method in VC, I must provide all parameters, including those which are optional in VB. And sometimes my VC program can not open Word documents. I think this may be the result of one or more wrong parameters. Then could I know the exact values of the optional parameters provided by VB itself? Then maybe my program can work fine Thank you !!!

Actionscript 3 :: Skip An Optional Parameter And Assign Value To The Parameter After The Skipped One? stackoverflow.com

Can we skip an optional parameter and assign value to the parameter after the skipped one? For example I have a function: public function Dialog(message:String,title:String="Note",dialogsize:int=99):void { } I can easily call the function with a message and a title: Dialog("HELLO","Intro"); Is there a way to skip the title and just pass in the dialogsize? I've tried it but can't make it work: Dialog("HELLO",,dialogsize); Is it possible to skip some optional parameters without using (rest) parameter?

Overloaded Vb Methods Not Found At Runtime When Called By C#? social.msdn.microsoft.com

Not sure if this question belongs here or the Interop forum, but here is the situation. I have a vb.net app that was upgraded from vb6. It has an overloaded Login method. A simple method with two string parameters for name/password calls the primary login method with numerous optional parameters. The simple method is for compatibility with C# because, until Visual Studio 2010, optional parameters were not supported.The C# intellisense finds the overload and compiles ok... but throws an error at startup stating that it cannot find the Login method. This makes no sense and appears to be a problem with vb. (I am using .net 4 for both vb.net and the c# test harness.)ILDASM shows the following: Public Function Login(ByVal LoginName As String, ByVal Password As String, ByVal Alias_Renamed As String, Optional ByVal LoginFrom As String = "", Optional ByVal ClientIPAddress As String = "", Optional ByVal ServerIPAddress As String = "", Optional [code].....

Have An Optional Parameter Of The Type List? www.vbforums.com

Is it possible to have an optional parameter of the type list?Ex. Private Function TestFunction(Optional ByRef MyList As List(Of Double)) The real problem is giving the list a default value. When dimming a new list, you can use the code below to give it a starting value: Dim MyList As New List(Of Double)(New Double() {1, 2, 3, 4, 5}) But even after trying many variations of the above code, I cannot get it to work as an optional parameter.

Set Default Value For A Unit Type Parameter? forums.asp.net

I want to include an optional parameter in a function statement that is of the type Unit. For example: Public Shared Function NewTable(Optional ByVal TableWidth As Unit) As Table Optional parameters require a default value, but I cannot figure out how to set a default value for a Unit type.

.net - Setting SqlDateTime.Null In A Constructor? stackoverflow.com

How do I set a null value for an optional DateTime parameter in a constructor? I'm using the following constructor below and I want the optional parameter admissionDate to be a null DateTime. Setting it to Nothing actually gives it a value (something like #12:00:00 #). Public Sub New(ByVal obj1 as Object, Optional ByVal admissionDate As DateTime = System.Data.SqlTypes.SqlDateTime.Null)

Implicit Conversion From Data Type Datetime To Int Is Not Allowed. forums.asp.net

Here is the situation... I am using SQL Server 2000.  I have created a Store Procedure to insert information, 4 of the fields are date types.  I am using OleDb Data Provider (System.Data.OleDb) namespace. The dates are filled by a form (web form) on submit event, I created a class that has functions to create my OleDb Parameters.  I add the parameters to the command and execute it through a SQL Server Stored Procedure.  In the event that I must have coded something wrong, I tested in the SQL Query Analyzer and the IN parameters for the date I used the getDate() method.  This is where I know it is OleDb and SQL Server Parameters. What Converstion Format should I use in the SP for the date?  OleDb.date are doubles from some date in 1979 or something or another.  So I used an OleDbDataType.DBDate.  It seems that when the Stored Procedure uses the IN Parameters dates provided by OleDbDataType.Date or DBDate, that it doesn't like the int format.  I am guessing that I am not converting the date in the parameters in the Insert of the Store Procedure... this is basically what I have... Function to add parameters and execute SP private int _startdate = DateTime.Now; private int _finishdate = DateTime.Now.AddDays(30); OleDbParameter[] myParams = { ParamBuilder("@StarDate", OleDbType.DBDate, 8, _startdate), ParamBuilder("@FinishDate", OleDbType.DBDate, 8, _finishdate) }; ExecuteNonQuery("myInsert", myParams); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CREATE PROCEDURE myInsert @StartDate datetime, @FinishDate datetime AS INSERT INTO myTable (STARTDATE, FINISHDATE) VALUES (Convert(datetime, @StartDate), Convert(datetime, @FinishDate)) Please keep in mind that I am using System.Data.OleDb namespace.....  please don't tell me to use SQLClient, it seems since I've been so adaptive of using OleDb, that it sould work just as well.  I am way too far into this to change my Provider to SQL Client, but I promise myself that the next project (if using SQL Server, I will be using SQLClient and I will keep using OleDb for Oracle.) *sigh* Help!

Specify Optional Paramaters In VBSCript www.xtremevbtalk.com

Hi,I am programming in vbscript and i want to Open an xls spreadsheet with a password paramater.To do this in vba i would specify:Open FileName:="filename", Password:="password"where there is other optional paramaters not specified here. However with vbscript, i cannot specify the optional paramater notation := , currently I can open the xls spreadsheet but it prompts me for a password:objxls.Open "filename"therefore how do i specify the password in this command taking into account that:1. it isnt the second parameter in the paramaters list, therefore there needs to be some mechanism to tell the function what parameter it is (just like Password := )2. I dont want to have to specify all other parameters just to give the password as a parameter.Thanks for your help

Data Report With Parameters And Data Environment www.vbcity.com

Anyone PLEASE help! I am desparately trying to figure out how to generate a report (using VB report designer and Data environment) where the user will be promted for a start and end date and then be shown a report with transactions within those dates. So far I have a query in the DE that has >=? in the date field (with "StartDate" as the alias), and <=? in another date line (with "EndDate" as the alias). I changed the parameter type to date. Can you not have 2 parameters on the same field?When I run it, I get an error..."argument not optional". I tried making the parameters "optional" set to False, but I get the same error. When I get rid of the second parameter, it works just fine, but I need to see all records between 2 dates. ANY suggestions would be greatly appreciated!!! Thanks

Web Forms :: Passing Parameters To ExpressionBuilder forums.asp.net

I have a custom ExpressionBuilder in whixh I'm trying to add a list of optional parameters. My method would be declared as follows: public static string GetResource(string expression, params object[] parameters) { } The way I'm calling this method from an ASP.NET page is this at the moment: <ext:Button ID="btnEdit" runat="server" Text="<%$ AppResources : edit_text %>"> Does anyone know how to perform this method call, but using optional parameters?

Optional Parameters, IsMissing And Boolean www.xtremevbtalk.com

Dear all,I am trying to write a procedure that takes an optional parameter of type boolean. The problem is that I want the default value to come from an array, the element of which is determined by another optional parameter:<vb>sub mysub(optional int_array_item as integer=0, optional bln_variable as boolean = ary_bln_global_array(int_array_item))'...end sub</vb>The problem is that int_array_item hasn't been declared until after the sub has been entered.So I try again by not specifying the default value for the boolean in the procedure arguements but instead try and use the IsMissing(bln_variable) function to see if the optional parameter has been passed before then deciding whether or not to set it to the array value.But this doesn't work, because the ismissing function always returns false for booleans. (As far as I can tell?)So what can I do about?Do I have to resort to defining my boolean as a variant?Thanks,mpk

Use ADO To Connect, DAO To Manipulate ? www.vbforums.com

Hi folks. I need some help please. I have a secured access database, secured using a workgroup file. The workgroup file has been setup simply as having a user called "logic" as the admin, "admin" is a user. I have opened a connection to the database, via the workgroup file, but what i also want to do now (aswell) is to open a connection to directly manipulate the permissions of "admin" such that no permissions on the database are available. (I was told previously that I need DAO to do the pems bit). At present, i have not set any passwords etc in the DAO line of code (ie DAO.OpenDatabase...), assuming that is isnt needed (mistake?) as the connection via the workgroup file is open already. here are my snippets of code. I will be honest, I am struggling with this!this is my "open the connection via the workgroup file" (class)VB Code:'===================================Public Sub OpenSecurityConnection()'===================================Dim strConnectPath As StringDim strSubFuncName As StringDim strDataSource As StringDim strDataSystem As String strSubFuncName = "clsDataAccess:OpenConnection"On Error GoTo ErrHandler strDataSource = FULL_PATH_TO_DATABASE & "" & mstrDBNamestrDataSystem = App.Path & "" & SECURITY_MDWSet mconDBConnection = GetJetConnection(strDataSource, adModeReadWrite, "", strDataSystem, SECURITY_UID, SECURITY_PWD,  DBTYPE_ACCESS2000)mconDBConnection.CursorLocation = adUseClient Exit SubErrHandler:    ErrorHandling strSubFuncName, Err.Number, Err.Description, Err.Source    End Sub "open via jet" (class)'======================================Public Function GetJetConnection(strDBPath As String, Optional lngMode As ADODB.ConnectModeEnum, Optional strDBPwd As String = "", Optional strSysDBPath As String = "", Optional strUserID As String = "", _ Optional strUserPwd As String = "", Optional lngEngineType) As ADODB.Connection'======================================Dim dbDatabaseConnection As ADODB.ConnectionDim strSubFuncName As String strSubFuncName = "clsDataAccess:GetJetConnection"On Error GoTo ErrHandler Set dbDatabaseConnection = New ADODB.ConnectionIf lngEngineType = DBTYPE_ACCESS97 Then  dbDatabaseConnection.Provider = "Microsoft.Jet.OLEDB.3.51"Else  dbDatabaseConnection.Provider = "Microsoft.Jet.OLEDB.4.0"End If dbDatabaseConnection.Mode = lngModedbDatabaseConnection.Properties("Jet OLEDB:Database Password") = strDBPwddbDatabaseConnection.Properties("Jet OLEDB:System Database") = strSysDBPath If lngEngineType = DBTYPE_ACCESS2000 Then  dbDatabaseConnection.Properties("Jet OLEDB:Engine Type") = lngEngineTypeEnd If dbDatabaseConnection.Properties("User ID") = strUserIDdbDatabaseConnection.Properties("Password") = strUserPwddbDatabaseConnection.Open "Data Source=" & strDBPath Set GetJetConnection = dbDatabaseConnectionSet dbDatabaseConnection = Nothing Exit FunctionErrHandler:    ErrorHandling strSubFuncName, Err.Number, Err.Description, Err.Source End Function and here's my (form) code attempting to use a DAO connection aswell to alter the admin's perms.VB Code:'====================================Private Sub mnuSecurity_Click()'====================================Dim strSubFuncName As StringDim objDB As DAO.DatabaseDim objCon As DAO.ContainerDim objDoc As DAO.DocumentDim strDataSource As String strSubFuncName = "frmMain:mnuSecurity_Click"On Error GoTo ErrHandler 'open connection via security workgroup fileSet gobjMSDataAccess = New COOImport.clsDataAccessgobjMSDataAccess.DatabaseName = DB_DATABASEgobjMSDataAccess.OpenSecurityConnection 'DAO stuffstrDataSource = FULL_PATH_TO_DATABASE & "" & DB_DATABASESet objDB = DAO.OpenDatabase(strDataSource, , False)Set objCon = objDB.Containers("databases")Set objDoc = objCon.Documents("MSysdb")If objDoc.UserName = "Admin" Then    objDoc.Permissions = dbSecNoAccessEnd IfSet objDoc = NothingSet objCon = NothingSet objDB = Nothing'closeCloseConnection Exit SubErrHandler:    ErrorHandling strSubFuncName, Err.Number, Err.Description, Err.Source End Sub Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack

Stored Procedures And Optional Parameters forums.databasejournal.com

Is it possible to find the value of an optional parameter from SQL's system tables , e.g. create procedure sp1 @param1 varchar(2) = 'xx'

Optional 'Color' Variable Parameters In Classes? www.xtremevbtalk.com

Is it possible to make Color variable parameters in custom classes Optional?Everytime I try, it gives me a "Constant expression required" error.[code]

Java: Switch Statements & Optional Parameters? stackoverflow.com

Is there an equivalent in Java to VB.NET's optional parameters?Also is it possible to switch on anything other than integers in Java?

OpenSUSE Hardware :: Lm_sensors Doesn't Start? forums.opensuse.org

I am operating openSUSE 11.2 x86_64 KDE4.3 after installing sensors then adding Code: acpi_enforce_resources=no to my optional kernel parameters and running [code]....

Setting User Defined Type As Optional VB6 www.vbforums.com

i have the following piece of code:Public Function getpoints(Piece As Integer, Optional Board5 As chessboard, Optional BoardMode As Boolean = False) As Singlechessboard is a user defined typewhen run it says: Compile Error:Invalid optional parameter typewhats wrong here? am i not allowed to set a user defined type as optional or what?

SSIS OLEDB Data Source Query Parameters Connect To Oracle social.msdn.microsoft.com

�Hi,� � I'm trying to use query parameters with an Oracle OLEDB Source in a data� � flow task and I'm having problems.� � I've tried formatting the query each of the following ways...�� --� � select� � frq_code,� � frq_name,� � update_frq,� � uptime_frq� � from frequency_bcs� � where update_frq > ?� � and update_frq <= ?� � --�� � Parameters cannot be extracted from the SQL command.� The provider might not� � help to parse parameter information from the command.� In that case, use the� � "SQL command from variable" access mode, in which the entire SQL command is� � stored in a variable.� � Additional information� � ---> Provider cannot derive parameter information and SetParameterInfo has� � not been called.� (Microsoft OLE DB Provider for Oracle).�

Lesson Learn't The HARD Way! www.vbforums.com

as an inexperience learner I have been writing code, asking for help, using code generously supplied by experienced programmers from this site. Generally I 'play' with code to understand what it does or how it works. I usually 'tab it' using ' run the program and work from there. Usually I end up with a program that needs all the green text removed - this time I removed loads of it along code that I should have left (no, I did not back it uup before saving )Now I get :Compile errorUser defined tyoe not definedand the follwing Sub Highlighted:Public Sub PrintEx(Optional ByVal sText As String, _ Optional ByVal X As Single = -1, _ Optional ByVal Y As Single = -1, _ Optional ByVal eFormat As AlignmentConstants, _ Optional ByVal sFontName As String, _ Optional ByVal nFontSize As Single, _ Optional ByVal eFontStyle As enumFontStyle = peNormal, _ Optional ByVal eFontColor As ColorConstants = vbBlack, _ Optional ByVal bNoCRLF As Boolean =End subI have tried going back to my post where this code was offered as a solution, but I can't find it (are posts removed?)please help

Can't Load Grid View? www.vbforums.com

I have an vb 2008 express application that connects to an Access db via oledb (configured by the VB wizard), then from the db it feeds two datagrid views. It works perfectly in my PC however when installing it to other pcs get an exception... Message: No value given fro on or more required parameters Source: Microsoft Office Access Database Engine StackTrace: System.Data.OleDb.OleDbException: No value given for one or more required parameters. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)[code]......

Optional www.vbforums.com

Hi there, i have created a new sub, and have put its one parameter set to optional, then in the procedure i test to see if the sub was passed the parameter or not, but on testing it, the ismissing( ) always return false even if nothing is passed to the sub. the parameter type is integer and it no value is passed it seem to get automatically assigned the value 0. Any ideas on what is happening here?Thanks for any help, Piers

Help For Defining Default Values Optional Parameter www.vbcity.com

Hello,I've written a little sub for updating a progress bar. I know how to define default values for certain optional parameters, such as strings and integers, which I have used in this sub. Previously, I was only updating a single progress bar in one form. Now I would like to use the same sub to update a progress bar on a separate form. I wanted the value of which form to use to be optional, defaulting to the main form (that the sub is on).I tried to do something like this...Code:Public Sub ProgressBarUpdater(ByVal CurrentStep As Integer, Optional ByVal StatusBarNote As String = "", Optional ByVal TotalSteps As Integer = 12345, Optional ByVal HideProgressBar As Boolean = False, Optional ByVal FormName As Form = Me)If TotalSteps <> 12345 Then FormName.ProgressBar1.Maximum = TotalStepsThis gives me an error on the "Me", saying "Constant expression is required", and an error in the sub on the "FormName", saying "ProgressBar1 is not a member of System.Windows.Forms.Form"How would I accomplish this?Thanks in advance for the help!

Optional Parameter Command Object www.vbforums.com

Using the ADO DataEnvironment... How do I get the optional parameters for a command object to work? I went to the Properties of the command object and named my parameters.. then set required to false and put a value there (basically, the default... this is what MSDN says to do).. but in code, if i dont pass one of the optional parameters, i get an error stating that the required paremeters have not been passed. Is there maybe a placeholder that I need to be using here in my call to the command object..Help please-gb

C# - Delaying Linq To SQL Select Query Execution stackoverflow.com

I'm building an ASP.NET MVC site that uses LINQ to SQL. In my search method that has some required and some optional parameters, I want to build a LINQ query while testing for the existence of those optional parameters. Here's what I'm currently thinking: using(var db = new DBDataContext()) { IQueryable<Listing> query = null; //Handle required parameter query = db.Listings.Where(l => l.Lat >= form.bounds.extent1.latitude && l.Lat <= form.bounds.extent2.latitude); //Handle optional parameter if (numStars != null) query = query.Where(l => l.Stars == (int)numStars); //Other parameters... //Execute query (does this happen here?) var result = query.ToList(); //Process query... Will this implementation "bundle" the where clauses and then execute the bundled query? If not, how should I implement this feature?

ODBC Connection To Data Reports visualbasic.ittoolbox.com

hii am using data reports in my project and i have used Microsoft jet oledb 4.0 provider for connection purpose, because i had to pass sting parameters to my reports.is there any way i can use "microsoft oledb provider for odbc drivers" to connect to my data reports and can still pass string parameters. because when i try to connect thru odbc then i can only pass numeric parameters to my reports.Haroon

Variable Parameters [Solved] Simple One www.vbforums.com

How does one write functions which can accept variable parameters.For eg:Code:Public Function OpenTable(ByVal mstrquery As String, ByVal mcursorLocation As String) as stringEnd functionNow, OpenTable function needs accept two parameters when it is called.What I want to do is that if - I dont pass - say the second parameter - then it shd take a default value for it.How do I do this that - so I dont get the error - argument not optional?

Strong Typed Optional Array Parameter www.vbforums.com

Does anyone know how to create a strongly typed byref optional array to a sub/function in VB? I have sub I'm working on where the last three parameters are optional. The last two happen to be arrays (one should be boolean and the other string).If I was to require the parameters, then I'd simply call it like so: ByRef ColumnHeaders As String, ByRef VisibleCols() As Boolean, ByRef ColumnFormats() As StringBut I want them to be optional.But when I add Optional to the array parameters, I get a syntax error saying that they should be variant or some specific type with a default value. Tg

Write A Function In A CodeIgniter Controller Which Can Take Optional Parameters? stackoverflow.com

I'm trying to write a function in a CodeIgniter controller which can take optional parameters. However, I always get Missing Argument warnings. I'm not trying to suppress the warnings - I'm trying to declare the parameters as optional (maybe they could be empty strings if they don't exist, or something).

Function Definition With Optional Parameters? bytes.com

Some of the functions that are part of PHP have optional parameters. Is it possible to define your own function so that it has optional parameters? If so, how is that done?

Delete *fields* From A Table **RESOLVED** www.vbforums.com

Hi,I need a way to delete a field from a table. Is there any SQL command that can do this, or would I have to use ADO, or something else?These fields are part of an 'extra data' table which my program reads and lists all the fields so the user can add data that isnt in any existing table. By the way, I am using this code to Add a field to a table (which works great), but I can't figure out how to modify it so that it will let me delete a field. Anyone know?VB Code:Public Sub CreateADOField(DbFile As String, strTablename As String, _    strFieldName As String, Style As Variant, Optional intLenght As Integer)     On Local Error Resume Next      ' Add to references   ' Microsoft ADO Ext. 2.x for DDL and Security        Dim cat     As New ADOX.Catalog    Dim tbl     As New ADOX.Table    Dim Col     As New ADOX.Column     cat.ActiveConnection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & _         DbFile & ";"     Col.name = strFieldName    Col.Attributes = adColNullable    If intLenght > 0 Then Col.DefinedSize = intLenght    Col.Type = Style    cat.Tables.Item(strTablename).columns.Append Col    cat.Tables.Item(strTablename).columns.Item(strFieldName).Properties("Jet OLEDB:Allow Zero Length") = True   ' use field properties to set parameters    Set cat = Nothing    End Sub

User Created Functions With Optional Parameters www.vbforums.com

Does anyone know if it is possible to write functions that have optional parameters? Like the Instr has the optional comparison type and starting position parameter.

Actionscript 3 :: Null Object Reference When Attempting To Check If It Exists? stackoverflow.com

I have a weird problem. An Object is being passed to my function, and some parameters are optional, so naturally I would check to see if they are there, and if not, do nothing.However, I'm getting a null reference error (#1009) when I'm just checking it. Here's the sample: public function parseObject(params:Object) { if (params.optionalParam) trace("Got Optional Parameter!"); [code]......

Optional Parameters Passed To Stored Procedure bytes.com

In which system table the information about the optional parameters passed to stored procedure are stored. I know about the tbl_columns and all that stuff. From where can i can come to know the parameter is mandatory or optional. -- Message posted via http://www.sqlmonster.com

Function With Optional Parameter bytes.com

How to create function with optional parameter passed by reference? I've tried sth like this: function (&$param=NULL) // or: function (&$param=new array()) { //... } but parser is complaining that it expected ')' after $param. I know functions with optional parameters passed by reference exist in PHP (ie. ereg). So what am I doing wrong.

Optional Parameters Versus Method Overloads? www.vbforums.com

I was familiar with the optional parameters in vb 6 and it made sense given the capabilities of the language but why the heck does VB.Net support optional parameters when there is method overloading? Which one should I use and is there a difference? If there is a difference when should I use each one?

Why Do Optional Class Attributes In .NET Have A Different Syntax stackoverflow.com

I'm just curious why class/property attributes in VB.NET have a weird optional syntax such as: <TestAttr("a", "abc", Optional1:="foo", Optional2:=3)> VB.NET allows you to set optional parameters like this to avoid order restrictions (which is lovely) but in this case it's forcing you to that.For example this is not possible: <TestAttr("a", "abc", "foo", 3)> even though the parameters are in the same order as the original definition.

Actionscript 3 :: Start Position Of IndexOf Search? stackoverflow.com

I'm using the indexOf method to search for a substring in a String variable in Actionscript 3. The indexOf method allows you to specify a second, optional parameter - the starting position for the search. However, I'm not sure whether the position returned by indexOf is relative to the very beginning of the string, or to this optional parameter.

Access :: Parameterized Queries With Optional Parameters (Access DB)? forums.asp.net

so I have a web programming assignment for university where I'm building a website that uses an Access database but I have hit a brick wall with something.I'm using parameterized queries to query my database. For one of my queries, I want to be able to take a bunch of parameters that are optional, and if they aren't needed I'll pass in a value of null and I'd like the part of the where clause relevant to them to evaluate to true. This is straightforward in most databases, from my understanding you could do something like to make param1 an optional parameter. WHERE ((@param1 = ARandomColumnName) OR (@param1 = null)) However this can't be done using Access, as all parameters in a query are represented by a ?. Every ? is assumed to refer to a different parameter, so if you want to use a parameter more than one (like the above code I wrote does) then you'd have to pass it twice. This seems hacky to meSo what do I do? I have spent *hours* googling and banging my head on the desk. I'll cry if I missed something really obvious

Passing Null To Stored Procedure In Reporting Services social.msdn.microsoft.com

Hello, � I have a report.� I need to make a drop-down parameter optional.� I've setup the parameter to use a dataset as its source, and I need to allow the value to be null.� I've selected allow nulls check box, and I've even tried setting the default value to System.DBNull.Value.� But, when the entry is not selected (blank), no data ever comes back.� If the data is blank or null, my procedure works (I've tested it).� How do I send a null value to the database through reporting services report?� I was hoping to avoid creating a special query just for that purpose. � Thanks.

Databind To Object Parameter That Has One Or More Optional Parameters? stackoverflow.com

I have an object, called 'PERSON' This person object has a title, firstName & Surname property as well as many other which are at the moment irrelevant. It also has a read only property called Fullname which concatenates the two or three parameters mentioned above depending on an optional parameter 'withTitles' passed over when you call PERSON.FULLNAME PERSON.FULLNAME(true) <- Will add titles if there are any PERSON.FULLNAME(false) <- Will give the name without the title Public ReadOnly Property FullName(Optional ByVal withTitle As Boolean = False) As String [Code]... I get an error: PERSON does not contain a property of 'FullName'. If I change this to any other property that does not take a parameter it works as expected. Now I'm guessing that the binding procedure can't handle optional or mandatory parameters for object properties, is this right? Is there a better way to do it? I thought about looping through the collection to add them manually but that kinda defeats the object of DataBinding!

Passing A Date Argument To An Oracle Stored Procedure In VB.NET www.vbcity.com

I am using VB.NET to call an Oracle Stored Procedure which has one argument with a type of Date.I cannot seem to get the format right for passing the date parameter to the procedure.I have tried the Oracle TO_Date function but that doesn't work. My code looks like this :        Dim objcmd As New OleDb.OleDbCommand("RetrievequoteInfo", IpsCnn)        objcmd.CommandText = "Retrievequoteinfo"        objcmd.CommandType = CommandType.StoredProcedure        Dim orparm As OleDb.OleDbParameter = objcmd.Parameters.Add("@selecteddate", OleDb.OleDbType.DBDate)        orparm.Value = Cdate("26-feb-2003")                                  ("TO_DATE('26-feb-2003', 'DD-MON-YYYY HH24:MM:SS')")        Dim objrdr As OleDb.OleDbDataReader        objrdr = objcmd.ExecuteReaderWhen I execute the data reader I get an exception. Can anybody help with this problem?

Specify DEFAULT For Optional Parameter To Stored Procedure Wrapper Function? bytes.com

My problem is this (apologies if this is a little long ... hang in there):I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(OptionalByVal Arg1 As Integer _ Optional ByVal Arg2 As Integer _ Optional ByVal Arg3 As Integer [code].....

Optional www.vbforums.com

How to set all parameters in this property as Optional ?Public Property Let CellText(ByVal lrow As Long, ByVal ColKey As String, ByVal sText As Variant)When I add "Optional" before all byVal the line becomes red so there is some error.Is there any way to set lrow as optional ( only lrow) ?

Pass A Value When Call A Function www.vbforums.com

If I have a procedure declaration like this:VB Code:Private Sub MySub(ByRef Obj As Object, Optional ByVal Param1 As String, Optional ByVal Param2 As Integer, Optional ByVal Param3 As Integer)End Sub How can I know which parameter have a given value when MySub is called?Example:I call MySub like this:VB Code:Call MySub(Text1, "Text1", , 0) Hope you're all understand what i trying to do.Added [RESOLVED] to thread title - Hack

Declaring Optional Controls - Parameter Must Specify Default Value www.vbforums.com

I have a problem during defining a Sub routine in VB.Net. I am defining a sub routine which is as under Private Sub ActivateControls(rdbutton as RadioButton, Optional txt as Textbox, Optional txt2 as Textbox) End sub When I call this sub routine It gives me the Error that Each Optional Parameter must specify a default value. So, Here I can't understand that what can be the default value of a textbox. What default value I can use here to remove this error.

String Default Parameter Value After Conversion stackoverflow.com

We have a legacy component that has been converted from VB6 to VB.Net.The VB component was called from an ASPX page using Request("param") to pass optional parameters to function calls. That means the value is null/nothing if the parameter is not present.The parameters were then added to an ADODB call of a store procedure using Parameters.Append.When used from VB6 missing, Request("param") values were coerced into empty strings when passed to the VB6 component. This meant that the ADODB call was satisfied (for required parameters).When the code was ported to VB.Net, the null Request("param") values are now passed as null values (VB nothing?) and Parameters.Append skips adding the value if it is nothing. This caused the stored procedure calls to break as a required param was missing. If we change the component's function parameters to be optional and have paramname as string = "" defaults, will a null/nothing value be converted to an empty string, or is null/nothing treated differently to a parameter being simply missing?

Error : Optional Parameters Must Specify A Default Value stackoverflow.com

Public Function Foo(ByRef a As AClass, _ Optional ByRef b As BClass = Nothing, _ Optional ByRef c As CClass = Nothing) As XClass Error : Optional parameters must specify a default value.

Set A Default Value Of Functions Optional Argument To Null? social.msdn.microsoft.com

How can you set a function optional argument to null? For example, I want to set the optional argument intCode equal to Null. These arguments are used to send to a stored procedure as parameters. Public Function pubfnc_SetCommentCode(ByVal strFieldName As String, ByVal lngResultID As Int32, Optional ByVal intCode As Int32 = DBNull.Value) As String

Vb6 Declaring Functions - Error - "optional Parameters Must Specify A Default Value" www.dreamincode.net

I just got upgraded from VB6.0 to VB2010. I'm trying to move some of my program functions over and I'm getting an error on the ones where I use optional... Public Function GetFolder(ByRef FTT As String, Optional InitFile As String) I get the error at the end of the line, after the close par...the error is "optional parameters must specify a default value".

Problem While Trying To Execute Oracle Parameterized Stored Procedure social.msdn.microsoft.com

Hi, My name is Iram Levinger. I'm trying to build ssis package that select rows from SQL Server table and according to Conditional Split cube results I should execute oracle stored procedure with in and out parameters. The in parameters should come from the SQL select and� the output parameters should be inline parameter that I should declare on in the OleDB Command selecet statement. Here is the sql statement I wrote in the OleDB Command: declare @out_return_status as int � declare @out_return_msg as varchar (1000) � begin � exec�� clickace.cns_clk_sst_iw_pkg.update_instal_warranty_dates ?,?,?,?,?, @out_return_status,@out_return_msg end � When I click on the Refresh button in the ssis GUI I get the following error: An OLE DB error has occured. Error Code : 0x80040E51. An OLE DB� record is available. Source: OraOLEDB Hresult : 0x80040E51. Description :"provider cannot provide parameter information and SetParameterInfo has not been called." � Is someone can help with it? Thanks

MVC :: Controller Action Requires Parameter Be Named "id"? forums.asp.net

I have the following controller action code: [Code].... That way, I receive the error: The parameters dictionary contains a null entry for parameter 'prd' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetByProduct(Int32)' in 'Proventa.Controllers.Manager.PlanController'. To make a parameter optional its type should be either a reference type or a Nullable type.Parameter name: parameters If I just replace the name of the parameter from "prd" to "id" it works.

Insert Record Into Sql Database Express When Button Pressed forums.asp.net

I'm new to asp.net and I have gotten quite far with books and such but I'm stuck at this point. I have a web form that is mostly populated with data pulled from AD and all the user does is make a selection in two drop lists and enter their initials to sign. I can't figure out how to insert a record into a table when buttin pressed. I verified that all the data types are correct so it shoud pass the info but its just not going anywhere. I've atached the code below. Thanks,protected void accept_btn_Click(object sender, EventArgs e) { string adPath = LDAP://DC=********,DC=***; //Path to your LDAP directory servermembers adAuth = new members(adPath);  string username = Context.User.Identity.Name; string computer_name = System.Environment.MachineName;string comp_type = comptype.SelectedValue.ToString(); string install_type = installtype.SelectedValue.ToString();string date = DateTime.Now.ToString(); string email = adAuth.getemail(Context.User.Identity.Name);string agree = initials_txtbox.Text;string title = "Office";  test_lbl.Text = (username + " " + computer_name + " " + comp_type + " " + install_type + " " + date + " " + email + " " + agree + " " + title);   System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(); System.Data.OleDb.OleDbParameter parameter1 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter2 = new System.Data.OleDb.OleDbParameter(); System.Data.OleDb.OleDbParameter parameter3 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter4 = new System.Data.OleDb.OleDbParameter(); System.Data.OleDb.OleDbParameter parameter5 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter6 = new System.Data.OleDb.OleDbParameter(); System.Data.OleDb.OleDbParameter parameter7 = new System.Data.OleDb.OleDbParameter();System.Data.OleDb.OleDbParameter parameter8 = new System.Data.OleDb.OleDbParameter();conn.ConnectionString = "provider=System.Data.SqlClient; Data Source=./SQLEXPRESS;AttachDbFilename=|DataDirectory|/software.mdf;Integrated Security=True;User Instance=True"; command.Connection = conn; command.CommandText = "INSERT INTO [download_table] (username, computer_name, computer type, install type, date, email, agree, title) VALUES (?,?,?,?,?,?,?,?)";command.CommandType = CommandType.Text; parameter1.ParameterName = "username";parameter1.DbType = DbType.String; parameter1.Value = username; command.Parameters.Add(parameter1);parameter2.ParameterName = "computer_name";parameter2.DbType = DbType.String; parameter2.Value = computer_name; command.Parameters.Add(parameter2);parameter3.ParameterName = "comptype";parameter3.DbType = DbType.String; parameter3.Value = comp_type; command.Parameters.Add(parameter3);parameter4.ParameterName = "installtype";parameter4.DbType = DbType.String; parameter4.Value = install_type; command.Parameters.Add(parameter4);parameter5.ParameterName = "date";parameter5.DbType = DbType.DateTime; parameter5.Value = date; command.Parameters.Add(parameter5);parameter6.ParameterName = "email";parameter6.DbType = DbType.String; parameter6.Value = email; command.Parameters.Add(parameter6);parameter7.ParameterName = "agree";parameter7.DbType = DbType.String; parameter7.Value = agree; command.Parameters.Add(parameter7);parameter8.ParameterName = "title";parameter8.DbType = DbType.String; parameter8.Value = title; command.Parameters.Add(parameter8); try { conn.Open(); command.ExecuteNonQuery(); }catch (Exception ex) { } finally { conn.Close(); } }

How To Insert NULL Value With OleDbParameter www.xtremevbtalk.com

Greetings!I am sure this is the most basic question of all time, but after 2 hours of search I totally give up (which probably means that my search abilities are NULL).Ok, in the parameter of my storedProc, I have a field which is defined as a VarChar. I want to assign NULL to it. How do I do that? Code:Dim myParam = New OleDb.OleDbParameter("I want to insert NULL here", OleDb.OleDbType.VarChar, 255)Thanks for your help!

[2008] Images From DB To ImgList Error - Parameter Is Not Valid www.vbforums.com

I am trying to write a small app that will read images from an database to an image list. It does the first one, but then after that i get a "Parameter is not valid." exception ... see code below. vb Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "states.qmw") Dim cm As New OleDb.OleDbCommand("Select * from tblStates", cn) Dim rd As OleDb.OleDbDataReader [code]....

Input Paramter As Part Of OPENDATASOURCE bytes.com

I want to use an input parameter as my filename, but I get a synatax error message. Howerve, when I hard code the filename the proc compiles successfully. Thanks for any help. I'm using SQL Server 2005 LTR_90, LTI_ELIG_pct, LTI_REC_pct, LOW_SALARY, HIGH_SALARY FROM OPENDATASOURCE("Microsoft.Jet.OLEDB.4.0","Data Source=C:inetpubwwwrootORC_Beta_Companies"' + @infilename +'"Extended Properties=Excel 8.0")...[summary_data$] Syntax message: Msg 102, Level 15, State 1, Procedure importExcelSpreadSheetIntoeNavigator_DataORC, Line 244 Incorrect syntax near 'Microsoft.Jet.OLEDB.4.0'.

Optional Parameters www.xtremevbtalk.com

Basicaly, how do I define a subroutine so that if one parameter is not even put in the brackets at all, vb won't care. I'm sure you all know what a optional parameter is.Thanks for any help - Cyril