Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
That is what I wanted thanks,I prime the while with a print \ndate now I just have to figure out how to get my hash values into my db and I should be in good shape, one thing thats really throwing me for a loop is that the date is a string, and I am having trouble figuring out how to make it a sql small date time. someone sent me a link to sql standards the other day so much stuff not sure where to look first. I agree which is why I was trying to figure out how to add it to a %hash previously as a key, this is a one time issue, I will be recording values differently in the future so that hash is well formed so should not be an issue again. however my data.txt file did not contain a date label so my hash was not initialized properly I wanted columname->value, and date is columname now I need to fix my input files, then I should be able to use variables to loop through and get my records into the db.
use Win32::ODBC; use DBI; $DSN="Ptest"; $db = new Win32::ODBC("DSN=Ptest;UID=ptalerter;PWD=Ha55le12;"); if(!($db)){ print "Error connecting"; exit; } else { print "Hey you are connected \n"; } $SqlStatement = "insert into AllResults (Date,Login,Searchload,Search +Count,SearchResults,SearchSave,SearchDelete,SearchDetails,TaxLoad,Tax +Results,TaxDetails,ClientAdd,CMALoad,CMASave,CMADelete,ClientDelete,L +ogout) Values ('getdate()', '1','2','3','4','5','6','7','8','9','10', +'11','12','13','14','15','16')"; if ($db->Sql($SqlStatement)){ print "SQL failed.\n"; print "Error: " . $db->Error() . "\n"; $db->Close(); exit; } while($db->FetchRow()){ undef %Data; %Data = $db->DataHash(); print $db; } db->Close(); close file;

In reply to Re^2: inserting into file by grashoper
in thread inserting into file by grashoper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-24 20:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found