Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

tonyonlinux

@tonyonlinux
About
Posts
107
Topics
44
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Amazon API and C#
    T tonyonlinux

    Well what I was hoping to do is make a program in c# that would allow me to enter all my books that I have read kind of like the calibre program. However this program would do nothing more than take and parse amazon for similar books (recommendations) then check to see if the books i already in the database if it isn't then take and automatically used the amazon sample feature and send a sample of those books to the kindle.

    C# tutorial csharp database json question

  • Amazon API and C#
    T tonyonlinux

    I was wondering if anyone knows if the amazon api supports kindle book look. What I'm trying to do is take and make a database that stores the asins and then searchs amazon for recommended reads. Example if my database has Dan Brown = Lost Symbol I would hit search recommendations and then it would spit out a list Dan Brown = Angels and Demons Jeffery Deaver =Broken Window so on Just wondering if anyone knows how that might be done? Or a good tutorial of how to do it? I went to amazon's page but was lost. Not sure what api to download or which documentation to read. Sorry for the bother hopefully someone can shed some light on me.. thanks

    C# tutorial csharp database json question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    nevermind i think i got it it looks like i did anyway when i ran some test. I simply took and did the following on the if statement.

    if (tags.toUpper().Contains(str.ToUpper))
    {
    return true;
    }

    thanks again

    LINQ tutorial database question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    thanks for your help but it is still not working. I tried what you posted above. but i get no results what so ever now. I think it has something to do with not having the stringcomparer.cultureignorecase in there. I tried to put it back in there but it doesn't like the fact that tags is not that of a list :(

    LINQ tutorial database question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    so your are saying do this ?

    private static bool MyContains(string tags, string user)
    {

            List seperatewords = new List(user.Split(' ').ToList());
            List seperateTags = new List(tags.Split(' ').ToList());
            //new
            List matches = new List();
            foreach (var str in seperatewords)
            {
                string stringvalue = str.ToString();
                //new 
                if (tags.Contains(str))
                {
                    matches.Add(GetfullText(tags, str));
                    
                }
    
                //end new
                //original  if (seperateTags.Contains(str, StringComparer.CurrentCultureIgnoreCase)) { return true; }
                if (tags.Contains(matches.ToString(), StringComparer.CurrentCultureIgnoreCase)) { return true; }
            }
            return false;
        }
    
        private static string GetfullText(string tags, string str)
        {
            //get start of the word (the location/index)
            int idxStrat = tags.IndexOf(str);
            //get the First Index of space after the start location for the current word
            //=>the idxEnd
            int idxEnd = tags.IndexOf(" ", idxStrat);
            //now get the length
            int length = idxEnd - idxStrat;
            //finally return the hole string( eg lions instead of lion and lots instead of lot
            return tags.ToString().Substring(idxStrat, length); ;
        }
    

    :( i'm confused still sorry

    LINQ tutorial database question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    Hey I know we have talked on this before. Still have an issue with it a little bit. What is happening is if i type in say lifeskills i will get a result for that. and also the match all works where if i typed in lifeskills christmas. That works perfectly the problem is it checks for the "whole word". Is there a way to check for instance if you type in lifeskill instead of lifeskills it will find it or if you type in say bear instead of bears ? here is what i have so far thanks for your previous help by the way...

        public static IEnumerableGetbyKeywordLookup(string keywords)
        {
           
               var results = from o in BookProxy.Readall()
              //var results = from o in BookProxy.ReadallbyTags(keywords)
                          where MyContains(o.TagName,keywords.Trim())
                          
                          select new GridProxy
                          {
                              Author = string.Format("{0} {1}", o.AuthorFirstname, o.AuthorSurname),
                              AuthorID = o.AuthorID,
                              AuthorFirst = o.AuthorFirstname,
                              AuthorSurname = o.AuthorSurname,
                              TagID = o.TagID,
                              BookID = o.bookID,
                              ISBN = o.ISBN,
                              BookNumber = o.RefNumber,
                              BookTitle = o.Title,
                              Count = BookNumberProxy.getall().Count(c => c.BOOK\_ID == o.bookID)
                          };
               printerlist = results.ToList();
            var distinct = results.GroupBy(o => o.ISBN).Select(o => o.FirstOrDefault());
            return distinct.ToList();
        }
    
        public static IEnumerable GetbyKeywordLookupAll(string keywords)
        {
            
            var results = from o in BookProxy.Readall()
                          where MyContainsAll(o.TagName, keywords.Trim())
    
                          select new GridProxy
                          {
                              Author = string.Format("{0} {1}", o.AuthorFirstname, o.AuthorSurname),
                              AuthorID = o.AuthorID,
                              AuthorFirst = o.AuthorFirstname,
                              AuthorSurname = o.AuthorSurname,
                              TagID = o.TagID,
                              BookID = o.bookID,
                              ISBN = o.ISBN,
    
    LINQ tutorial database question

  • Is there a way to change a column property in a table without having to delete the entire table?
    T tonyonlinux

    wow that worked perfectly. Luc i can't thank you and the other's enough for all your help you have given me. Hopefully one day I will be able to help others and return the favor in which you have given me. Thanks again.

    Database database help question

  • Is there a way to change a column property in a table without having to delete the entire table?
    T tonyonlinux

    I have a database that holds information including isbn numbers for books. I discovered that the isbn is not specifically a 10 digit number it can actually have a character in it so i need to change it to an nvarchar but when i try to do so it says i can't that the table needs to be dropped. Surely I don't have to delete the table and reenter thousands or records just to change that property or do I? Please help thanks.

    Database database help question

  • how to write to a specific range in excel ? [modified]
    T tonyonlinux

    well i got it sorta working. The thing I'm having trouble with is one of the cells is merged D to G if i insert values "('A,'B','C','D')"; i get an error saying it can't expand. I also tried putting '' for column e,f,g and that didn't work either. Any idea how to insert a value into the merge cell? i tried to find some info online about this but came up try.

    C# tutorial question

  • how to write to a specific range in excel ? [modified]
    T tonyonlinux

    For some reason this code is not writing to my excel file and I can't figure out why. I have a premade template and it has a worksheet in it called bsheet and I also took and selected my range and hit insert/name and gave it the name btable I then put this in a button click event to test but the xls is not effected what might i be doing wrong?

    private void button1_Click(object sender, EventArgs e)
    {
    string connectionString = "Provider=Microsoft.Jet.OleDb.4.0; data source=c:\\BookList.xls; Extended Properties=Excel 8.0;";
    string selectString = "INSERT INTO btable VALUES('12345′, 'Acme Inc', 'Acme Way', 'CA')";

            OleDbConnection con = new OleDbConnection(connectionString);
            OleDbCommand cmd = new OleDbCommand(selectString, con);
    
            try
            {
                con.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                con.Dispose();
            }
        }
    

    modified on Wednesday, March 3, 2010 1:52 PM

    C# tutorial question

  • is it possible to do this?
    T tonyonlinux

    i was wondering something since the documentation states if the parent minimizes so does the child. (this was really my original question) because i had read this in the documentation BEFORE asking. is it possible to make the add form an owner of itself? i tried and it said I can't. Basically what I'm trying to achieve all of the parent/child stuff asside is the following. I guess what i want is the form to not be a child but simply another parent (per say). I'm trying to make it where when i click on the addbutton up pops the addrecord form. and the main form minimizes. as documented and seen and so forth both will minimize. sure i can go down there and click on the thing to open it back up since the mainform is hidden until close(that part i like) but i want the child form return to normal state. is there some kinda method that you can use on the form like you do controls as form1.visible = false or hidden = true or something like that then change that on the form2 closeevent ?

    C# question

  • is it possible to do this?
    T tonyonlinux

    thanks that worked.

    C# question

  • is it possible to do this?
    T tonyonlinux

    to make mass data entry easier so i can put my add form over the top of my excel sheet that contains the data i wish to enter. Is there a way to do the following without it minimizing both. I understand the whole parent/child relationship of the forms but i was wondering if i could somehow do this because I have noticed programs like yahoo and so forth allow one form to be minimized while the other is maximized. Anyway here is what I'm trying...

    private void Add_Button_Click(object sender, EventArgs e)
    {
    AddRecord addRecordForm = new AddRecord();
    addRecordForm.Owner = this;
    this.WindowState = FormWindowState.Minimized; //minimize the main form
    addRecordForm.ShowDialog(this); // load up the add form

            this.WindowState = FormWindowState.Normal; //when the add form closes return main form to normal size
            LoadData();
        }
    

    it minimizes but they both minimize instead of only the parent minimizing. i even tried putting in the constructor of the addrecord this.windowstate = formwindowstate.normal; and that had no effect.

    C# question

  • doing case-insensitive keyword looks in a database using linq to sql (is it not possible ?)
    T tonyonlinux

    I have been battling this for a while now so maybe someone can help me out. I'm trying to do a keyword(s) lookup in my database. lets say the database has a record with tags of "lifeskills testing" and then two with just "lifeskills" currently with what I have i can type in lifeskills and it will only pull up the 2 with lifeskills only i need it to pull up all 3 because the tag is located in all three records. here is the code I have thanks.

    public static IEnumerable GetbyKeywordLookup(string keywords)
    {

            var results = from o in BookProxy.Readall()
                          where MyContains(o.TagName, keywords.Trim())
    
                          select new GridProxy
                          {
                              Author = string.Format("{0} {1}", o.AuthorFirstname, o.AuthorSurname),
                              AuthorID = o.AuthorID,
                              TagID = o.TagID,
                              BookID = o.bookID,
                              ISBN = o.ISBN,
                              BookNumber = o.RefNumber,
                              BookTitle = o.Title,
                              Count = BookNumberProxy.getall().Count(c => c.BOOK\_ID == o.bookID)
                          };
    
            var distinct = results.GroupBy(o => o.ISBN).Select(o => o.FirstOrDefault());
            return distinct.ToList();
    
    
       }
    

    private static bool MyContains(string tags, string user)
    {
    var separateWords = user.Split(' ').ToList();
    bool results = separateWords.Contains(tags, StringComparer.CurrentCultureIgnoreCase);
    return results;
    }

    i'm sure i'm overlooking something obvious but i just don't see it :(

    LINQ database csharp linq testing beta-testing

  • question about webviewer control
    T tonyonlinux

    yes I meant browser sorry. Okay i found the property thanks

    C# javascript question tools help

  • question in regard to updating using mssql
    T tonyonlinux

    i have a database model that has an isbn as the primary key The isbn is input by the user it is the primary key for book and book is linked to book_by_authors on the isbn number and it is also linked to bookcategory by the isbn and so forth. How in the the world could I update the isbn easily? I keep getting constraint issues with the foreign keys. Should I take and create a method that stores the existing values and then deletes the record then turns around and adds the record back with the corrected data? just wondering what should be done in this case. thanks

    Database question database sql-server announcement learning

  • question about webviewer control
    T tonyonlinux

    I placed a webviewer in my winapp that calls up the isbndatabase and conducts a search. For some reason I constantly get a script error for .js is there anyway to disable javascript so this error will go away or do I need to enable something ? thanks

    C# javascript question tools help

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    Thanks, I will take your advice. I read a lot but sometimes the examples are poor or simply wrong. Also, i have a hard time comprehending things (always have just a part of my life). Anyway, thanks for your kind words.

    LINQ tutorial database question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    well duh :( I feel really dumb on that one cause like you say that was simple. Thanks again for your help I really appreciate it.

    LINQ tutorial database question

  • Trying to do a keyword search but not sure how to use the contains method [modified]
    T tonyonlinux

    Thanks. I used method two and it works perfectly. I have one more question to ask. how would I I make it search where it contains both words? I see here it does a foreach on the split string and sees if it is inside the o.whatever and it works like it should if i enter say coke it finds everything that has coke in it. but if i specifically wanted the to display items containing where both the words exist in any sequence how would that be done ? Like if i have tags pizza coke drinker and another tag eggs coke and i enter in the search coke drinker. with the method you showed it would pull up both records. but i only want the one where BOTH words match? I'm sorry for all the questions this is really new to me. Thanks for your help.

    LINQ tutorial database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups