Results 1 to 22 of 22

Thread: Parameter to DataEnvironment

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Parameter to DataEnvironment

    Hi,

    I have designed a report using DataEnvironment as the Datasource.

    My Report have two parameters, one is of Integer type and the other is of String (Char) type.

    My Query works fine for Integer datatype, but when I add the string datatype then it gives me an error.

    In the parameter tab in dataenvironment what datatype to be selected when it is a string parameter. I have tried with all adstr,adlongstr,adchar etc but of no help.

    Any one please...

    Regards,

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    What is the error generated? What database are you using? And how are you setting the parameter?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Parameter to DataEnvironment

    Post your SQL statement or attach the data environment. Not enough info to help you.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    Hello,

    I am using Access 2000 as my Database.
    The error generated is Error No 13, Type Mismatch.

    I am passing the parametes from VB. The sql query in dataenvironment is as below :
    Code:
    select OrderEntry.Code,CustOrderNo,OrderDate,OrderSrNo,ItemName,Measurement,OrderQty from OrderEntry,OrderEntryDetails,ItemMaster where OrderEntry.Code=OrderEntryDetails.OrderCode and OrderEntryDetails.ItemCode=ItemMaster.Code and CustomerCode=? and OrderDate between ? and ? and Status=?
    Where parameter 1 is Integer, Parameters 2 & 3 are Date/Time and Parameter 4 is String (Char)

    My call from VB is as below

    1 Code:
    1. Dim new_cn As New DataEnvironment1
    2. Dim from_date As String
    3. Dim to_date As String
    4. Dim status As String
    5.            
    6.     from_date = Format(DTPicker1.value, "dd/MMM/yyyy")
    7.     to_date = Format(DTPicker2.value, "dd/MMM/yyyy")
    8.    
    9.     If cboStatus.ListIndex = 0 Then         'For Pending Orders
    10.         status = "A"
    11.     ElseIf cboStatus.ListIndex = 1 Then     'For Completed Orders
    12.         status = "C"
    13.     End If
    14.  
    15.     new_cn.OrderEntryReport_Grouping CInt(cboName.ItemData(cboName.ListIndex)), CDate(from_date), CDate(to_date), status

    This works fine if I remove the last parameter.
    I don't know where it is going wrong.

    Regards

  5. #5
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,513

    Re: Parameter to DataEnvironment

    Have you checked the data type of the status parameter and field?

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    It would be best if you can attach a simple project that demonstrate your problem so we may have a look at it.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    Hello,

    Pls check the uploaded file.

    Regards,
    Rohit
    Attached Files Attached Files

  8. #8
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Try using the following sql statement since yours has a typo (OrderEntryDetaisl).
    select CustomerName,CustOrderNo,OrderDate,OrderQty,Measurement from OrderEntry,OrderEntryDetails,CustomerMaster where OrderEntry.CustomerCode=CustomerMaster.Code and OrderEntry.Code=OrderEntryDetails.OrderCode and ItemCode=? and OrderDate between ? and ? AND Status = ?
    And also don't forget to select the correct Host Data Type, if your Data Type is adDate then your Host Data Type should be date, etc.

    For the third parameter the following setting worked for me.
    Attached Images Attached Images  
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    Hi dee-u,

    I tried using your suggestion of setting the 4th parameter's data type and Host Data Type , but I am getting the error. Pls check the error image attached.

    I have not changed the query as I want ItemName on the report instead CustomerName.

    Regards,
    Attached Images Attached Images  

  10. #10
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Your typo was on this "OrderEntryDetaisl", did you change it already?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  11. #11
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Wait, I tested on the ItemWiseReport, will look at the other one.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    I didn't get you.
    What do u mean by "typo"

    Also my database table is "OrderEntryDetails"

    So whats this "OrderEntryDetaisl". I am not getting.

  13. #13
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Not sure if it is an ODBC issue since it works when I tried it with OledDb using the following connectionstring: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Stuffs\DataEnvi-Problem\DataEnvi-Problem\Database\CurrYear\data.mdb;Persist Security Info=False".
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    Ya got it. My mistake in writing the query (ItemDetails). Rectified it.
    Thanks.

    But the earlier one still gives an error.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    Will check it out writing the connection string instead of ODBC.

  16. #16
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Have a look at the attachment if it works for you.
    Attached Files Attached Files
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Re: Parameter to DataEnvironment

    In Data Environment, if I change the Provider from ODBC to Jet 4.0, then it worked fine for me. There is no error and getting the desired output.

    But this is Ok on my machine. The data path on my machine and client's machine is not the same. Is there any way to set the provider for Data Environment at run time.

    Regards,

  18. #18
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    You may follow how I did it in the attachment on my previous post.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Resolved Re: Parameter to DataEnvironment

    Ok. Thanks a lot.
    One last question.... Can I use password along with connection string for a password protected data.
    Last edited by mehtarohit; Jan 29th, 2009 at 04:07 AM.

  20. #20
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    Yes. Have a look at www.connectionstrings.com for the different types of connectionstrings.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  21. #21
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Parameter to DataEnvironment

    And to mark your thread as Resolved use the Thread Tools menu.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  22. #22

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    135

    Resolved [RESOLVED] Parameter to DataEnvironment

    Thanks dee-u

    All problems resolved.
    www.connectionstrings.com is a great one.

    Regards,
    Last edited by mehtarohit; Jan 30th, 2009 at 01:32 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width