Goodfix86's Profile User Rating: -----

Reputation: 4 Apprentice
Group:
New Members
Active Posts:
12 (0.01 per day)
Joined:
01-July 09
Profile Views:
1,734
Last Active:
User is offline Jul 13 2012 04:57 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
XBox
Your Car:
Chevrolet
Dream Kudos:
0

Latest Visitors

No latest visitors to show

Icon   Goodfix86 has not set their status

Posts I've Made

  1. In Topic: Developing robust hierarchical data in MSSQL

    Posted 13 Jul 2012

    Nice work!
  2. In Topic: Entity Framework and Sql Server

    Posted 9 Jun 2012

    You are absolutely right. It is right there in the source code and the intermediate language. I think that this solution is viable for me due to circumstances surrounding the project I am working on, but could be pretty high risk for anyone publishing a program for consumers or something that has to connect from another network.

    That would probably be good material for a thread on security. Maybe I'll start one and see what people have to offer.
  3. In Topic: Entity Framework and Sql Server

    Posted 4 Jun 2012

    I figured it out, but I forgot to return. Sorry everyone. This is what you have to do if you want to bury the password in the code. I am going to assume that you have already created an entity model with all the necessary associations and such.

    Need these in your header.
    using System.Configuration;
    using System.Data.EntityClient;
    


    Need this early on in your app to set the stage. This tosses the connection string through the connection stringbuilders. We start general, move more specific, set the password and then pop it back out the way we came.
    ConnectionStringSettings myConfigString = 
       ConfigurationManager.ConnectionStrings["[i]Insert Connection Name Here[/i]"];
    var efStringBuilder = new EntityConnectionStringBuilder(myConfigString.ConnectionString);
    System.Data.SqlClient.SqlConnectionStringBuilder mySqlBuilder = 
       new System.Data.SqlClient.SqlConnectionStringBuilder(myEfStringBuilder.ProviderConnectionString);
    mySqlBuilder.Password = "[i]Insert Password Here[/i]";
    myEfStringBuilder.ProviderConnectionString = mySqlBuilder.ConnectionString;
    
    


    Later when it comes time to query pass the connection string as a parameter to the datacontext.
    var currentContext= new EntityModelName.DataContext(myEfStringBuilder.ConnectionString);
    
  4. In Topic: C# / PDMWorks.dll Interop Search Program

    Posted 4 Jun 2012

    I appreciate that you are trying to save me some grief by directing me to create a VB project, but at this point my curiosity has taken on a life of its own.

    I figured it out and it was WAY simple and a little bit embarrassing for me. I had to typecast the index of PDMWSearchResults as a PDMWSearchResult. I thought I had already tried this, but I just did it and it worked.

    static void Main(string[] args)
    {
       PDMWorks.PDMWConnection pdmwVaultConn = new PDMWorks.PDMWConnection();
       PDMWorks.PDMWSearchResults results;
       PDMWorks.PDMWSearchResult result;
    
       pdmwVaultConn.Login("*****", "*****", "*****");
    
       var searchOptions = pdmwVaultConn.GetSearchOptionsObject();
    
       searchOptions.SearchCriteria.AddCriteria(
          PDMWAndOr.pdmwOr, 
          PDMWPropertyType.pdmwDocumentName, 
          "",
          PDMWConditionType.pdmwContains, 
          "123456");
    
       results = pdmwVaultConn.Search(searchOptions);
    
       result = (PDMWSearchResult)results[0];
       Console.WriteLine(result.Name);
    }
    

    The search results is of type PDMWSearchResults, but is passed back as System.__ComObject at runtime. I read a bunch of articles on reflection and other stuff that doesn't look fun so I'm happy that this works.
  5. In Topic: sqlserver.jdbc.SQLServerException: The connection is closed

    Posted 30 Apr 2012

    This might not be applicable, however...

    Earlier on you mentioned that this works in the base class, but not when you call it from another. If the base class was created in a different project and the connection string is established in the config file, then you must manually copy and paste the connection string in the orginal project's config file into the new new project's config file. I guess I shouldn't say must. You could also use one one of the connection string builders and send it into the connection's constructor method.

    I agree with the previous posts. Connections can be pretty valuble. You should open and close them as needed. I don't see a good reason why the connection would already be open when it enters this function.

    You could also wrap your connecction open statement (stmt.Open();?) inside of a try catch and send out a message box to warn you if your connection is equal to null. That might help study the program's behavior.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Interests:
ADO.net, Entity Framework, SQL, SQL Server, Business Intelligence Development Studio (BIDS),
Years Programming:
12
Programming Languages:
C++, C#, SQL

Contact Information

E-mail:
Click here to e-mail me

Comments

Goodfix86 has no profile comments yet. Why not say hello?