Hi All,
Please see the code below:

Code:
                    Dim vencode As String
                    conn.Open()
                    Dim cmdvenstr As String = "Select vendor_code from tbl_vendor where vendor_name='" & cmbVendor.Text.Trim() & "'"
                    Dim cmdven As New SqlCommand(cmdvenstr, conn)
                    vencode = cmd.ExecuteScalar()
                    MessageBox.Show(vencode, "IG", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
on the messagebox everything is coming other than the value of vencode. where am I going wrong. In the database vendor_code datatype is nvarchar(50).