Got a problem with CGI - can it be converted to asp.net? RRS feed

  • Question

  • User-718146471 posted

    Ok, what I want to do is take input from a simple web post that used to be in CGI format and post it into my database. I am figuring using .net would be cleaner and easier to maintain. However, I have no clue how to convert this to .net. I could use some help please...thanks :)  The script below doesn't error out but it also doesn't insert either... The script reads like this:

    use strict; 
    use warnings; 
    use CGI qw(:standard); 
    use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
    use DBI qw(:sql_types); 
    my $title = 'Reading List'; 
    my $start = 40; 
    print header(), start_html($title),
    h1({-style=>"font-size:1.2em"}, $title);
    my $value = param("value");
    print "'value' param = $value"; 
    my $dbName = "DATABASE"; 
    my $dbHost = ""; 
    my $dbUser = "user"; 
    my $dbPass = "pass"; 
    my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n";
    my @fields = param();
    my @values = param(my $variable);
    my @filehandles = upload(my $variable);
    if(param()) {
      for $variable(@fields) {
        for my $value(@values) {
        else {
          my $sql = "INSERT INTO data_in (raw_id, data_xml) VALUES (default,\"$value\")";
          my $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
          $sth->execute() || print "execute: $sql: $DBI::errstr";
          print "12.3";    # content
    else {
      print "empty";
    print "</html>"; 

    Wednesday, December 16, 2009 10:51 AM


  • User-718146471 posted

    Never mind, decided to do this with .net 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 16, 2009 12:18 PM