none
sql connection RRS feed

  • Question

  • Hopefully this will be easy. I have a asp form that passes values to strings that I am trying to enter in a sql database. I found the exact issue here https://stackoverflow.com/questions/34317499/validate-user-access-ado-net-sql-2008.

    The problem is when I try and use the following and change it from tJobNo to tJobNo.Value or . Text I dont get the options for .Value or Text. I get all kinds of other options but not that. any ideas?

    input.Parameters.AddWithValue("@tJobN", tJobNo);

    • Moved by CoolDadTx Friday, June 2, 2017 12:38 PM ASP.NET related
    Thursday, June 1, 2017 10:57 PM

All replies

  • Here is my connection driving me crazy

     using (SqlCommand input = new SqlCommand())
                    {
                    input.Parameters.AddWithValue("@convertedDate", newDate);
                    input.Parameters.AddWithValue("@tJobN", tJobNo);
                    input.Parameters.AddWithValue("@techName", techName);
                    input.Parameters.AddWithValue("@guageNumber", guageNumber);
                    input.Parameters.AddWithValue("@dailyDc", dailyDc);
                    input.Parameters.AddWithValue("@dailyMc", dailyMc);
                    input.Parameters.AddWithValue("@correctionFactor", correctionFactor);
                    input.Parameters.AddWithValue("@materialDescription", materialDescription);
                    input.Parameters.AddWithValue("@qcTestIdNumber", qcTestIdNumber);
                    input.Parameters.AddWithValue("@testNo", testNo);
                    input.Parameters.AddWithValue("@stationLocation", stationLocation);
                    input.Parameters.AddWithValue("@deptTest", depthTest);
                    input.Parameters.AddWithValue("@convertPercentCompaction", convertPercentCompaction);
                    input.Parameters.AddWithValue("@convertPercentMoisture", convertPercentMoisture);
                    input.Parameters.AddWithValue("@convertPoundsOfMoisture", convertPoundsOfMoisture);
                    input.Parameters.AddWithValue("@convertedDryDensity", convertDryDensity);
                    input.Parameters.AddWithValue("@convertWetDensity", convertWetDensity);
                    input.Parameters.AddWithValue("@convertMoistureCount", convertMoistureCount);
                    input.Parameters.AddWithValue("@convertMaximumDryDensity", convertMaxDryDensity);
                    input.Parameters.AddWithValue("@convertOptMoisture", convertOptMoisture);
                    input.Parameters.AddWithValue("@convertPercentRequired", convertPercentRequired);
                    input.Parameters.AddWithValue("@passFail", passFail);
                    input.Parameters.AddWithValue("@correctFactorUsed", correctionFactorUsed);
                    input.Parameters.AddWithValue("@remarks", remarks); ;
                    input.CommandText = "INSERT into fieldValues (date, jobNo, tech, project, reportNumber, guageNumber, dailyDc, dailyMc, correctionFactor, materialDescription, qcTestId, testNo, stationLocation, elevationReferance, depthofTest, percentCompaction, percentMoisture, poundsOfMoisture, dryDensity, wetDensity, moistureCount, maximumDryDensity, optMoisture, percentRequired, passFail, correctFactorUsed, remarks) VALUES (@convertedDate, @tJobNo, @techName, @projectName, @reportNumber, @guageNumber, @dailyDc, @dailyMc, @correctionFactor, @materialDescription, @qcTestIdNumber, @testNo, @stationLocation, @elevationReferance, @deptTest, @convertPercentCompaction, @convertPercentMoisture, @convertPoundsOfMoisture, @convertedDryDensity, @convertWetDensity, @convertMoistureCount, @convertMaximumDryDensity, @convertOptMoisture, @convertPercentRequired, @passFail, @correctFactorUsed, @remarks)";
                    input.Connection = con;
                    con.Open();
                    input.ExecuteNonQuery();
                    con.Close();

    Thursday, June 1, 2017 11:13 PM
  • Hi,

    Thank you for posting here.

    Since your issue is related to ASP.NET Form, I suggest that you can post the issue on ASP.NET forum.

    I will move the case to 0ff-topic forum.

    Best Regards,

    Hart


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 2, 2017 7:10 AM