How to insert a column values in existing db (msaccess 2000) table?

Discussion in 'C#' started by gilgalbiblewheel, Apr 6, 2005.

  1. #1
    Here's the link for the db table:
    http://k.domaindlx.com/gemetria/pageing.asp

    How do I insert a field of values?
     
    gilgalbiblewheel, Apr 6, 2005 IP
  2. davedx

    davedx Peon

    Messages:
    429
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    INSERT INTO `table_name`( new_id, new_recordType, new_book_spoke, ... ) VALUES( 'id_data', 'recordtypedata', 'bookspokedata', ... )

    That's how to do it with SQL, replace table_name with the name of the table and the "data" variables with the data you want to insert. If you only want to insert into some columns (e.g. only "new_id" and "new_recordType"), just only include them in the expression and the others will be inserted by the DB using its default values.
     
    davedx, Apr 7, 2005 IP
  3. gilgalbiblewheel

    gilgalbiblewheel Well-Known Member

    Messages:
    435
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    How can I insert new values?

    I want the result of this function to appear as value in the new table field.
    Dim ans
    
    function getKeyValue_h(chr)
    	//A select statement is more efficient for this
    	select case chr
    	 case "a"
    		getKeyValue_h = 1 
    	 case "b"	
    		getKeyValue_h = 2 
    	 case "g"
    		getKeyValue_h = 3 
    	 case "d"
    		getKeyValue_h = 4 
    	 case "h"
    		getKeyValue_h = 5 
    	 case "w"
    		getKeyValue_h = 6 
    	 case "z"
    		getKeyValue_h = 7 
    	 case "x"
    		getKeyValue_h = 8 
    	 case "j"
    		getKeyValue_h = 9 
    	 case "y"
    		getKeyValue_h = 10 
    	 case "k","$"
    		getKeyValue_h = 20 
    	 case "l"
    		getKeyValue_h = 30 
    	 case "m","~"
    		getKeyValue_h = 40 
    	 case "n","!"
    		getKeyValue_h = 50 
    	 case "s"
    		getKeyValue_h = 60 
    	 case "["
    		getKeyValue_h = 70 
    	 case "p","@"
    		getKeyValue_h = 80 
    	 case "c","#"
    		getKeyValue_h = 90 
    	 case "q"
    		getKeyValue_h = 100 
    	 case "r"
    		getKeyValue_h = 200
    	 case "f","v"
    		getKeyValue_h = 300 
    	 case "t"
    		getKeyValue_h = 400
    	 case else
    		getKeyValue_h = 0
    	end select
    end function 
    
    function computeValue(str)
    	ans = 0
    	for i = 0 to len(str)
    		ans = ans + getKeyValue_h(mid(str,i+1,1))
    	next
    	computeValue = ans 
    end function
    
    Code (markup):
    And then:
    <td size="200">
    <%Dim TheString, ArrayTemp, NumberOfWords, Word
    	TheString = rs("text_data")
    	ArrayTemp = split(TheString, " ")
    	NumberOfWords = UBound(ArrayTemp) + 1
    '	Response.Write "<P>The String is: " & TheString
     	Response.Write "<P><i>Number of words:</i> " & NumberOfWords
            Response.Write "<BR>Total=" & computeValue(TheString)	
    '	Response.Write "<P>Here are the words which compose that string: "
    	For Each Word In ArrayTemp
    	Response.Write "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
    	response.write computeValue(word)
    	next
    
    %>
    
    </td>
    
    Code (markup):
     
    gilgalbiblewheel, Apr 8, 2005 IP