Note that there are some explanatory texts on larger screens.

plurals
  1. POerror :ExecuteNonQuery: CommandText property has not been initialized
    primarykey
    data
    text
    <p>this code is in the button click , i get each data out using spilt but i encounter error at "cmd.CommandType = CommandType.Text"</p> <pre><code> Dim conn As New SqlConnection(GetConnectionString()) Dim sb As New StringBuilder(String.Empty) Dim splitItems As String() = Nothing For Each item As String In sc Const sqlStatement As String = "INSERT INTO Date (dateID,date) VALUES" If item.Contains(",") Then splitItems = item.Split(",".ToCharArray()) sb.AppendFormat("{0}('{1}'); ", sqlStatement, splitItems(0)) End If Next Try conn.Open() Dim cmd As New SqlCommand(sb.ToString(), conn) cmd.CommandType = CommandType.Text cmd.ExecuteNonQuery() Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Script", "alert('Records Successfuly Saved!');", True) Catch ex As System.Data.SqlClient.SqlException Dim msg As String = "Insert Error:" msg += ex.Message Throw New Exception(msg) Finally conn.Close() End Try </code></pre> <p>the same code , the below work Dim conn As New SqlConnection(GetConnectionString()) Dim sb As New StringBuilder(String.Empty)</p> <pre><code> Dim splitItems As String() = Nothing For Each item As String In sc Const sqlStatement As String = "INSERT INTO GuestList (groupID,guest,contact,eEmail,relationship,info,customerID) VALUES" If item.Contains(",") Then splitItems = item.Split(",".ToCharArray()) sb.AppendFormat("{0}('{1}','{2}','{3}','{4}','{5}','{6}','{7}'); ", sqlStatement, splitItems(0), splitItems(1), splitItems(2), splitItems(3), splitItems(4), splitItems(5), Session("customerID")) End If Next Try conn.Open() Dim cmd As New SqlCommand(sb.ToString(), conn) cmd.CommandType = CommandType.Text cmd.ExecuteNonQuery() Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "Script", "alert('Records Successfuly Saved!');", True) Catch ex As System.Data.SqlClient.SqlException Dim msg As String = "Insert Error:" msg += ex.Message Throw New Exception(msg) Finally conn.Close() End Try </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload