Cannot convert from 'void' to 'string' error message
I am trying to get an App to connect to an oracle database and found a lovely tutorial here: Tutorial is here.
I am not a programmer, but have plugged in into my program and I am getting an error message
argument 1: cannot convert from'void' to 'string'
in the bit where I am calling the connect and query method. Any advice on how to fix the issue?
The problem is from when I try to call the ConnectAndQuery method to show the results.
public partial class UpdatePOsNewUser : Form
int sum = 0;
private static string CONNECTION_STRING =
"User Id=MyUser;Password=MyPassword;Data Source=(DESCRIPTION=" +
// This really didn't need to be in its own method, but it makes it easier
// to make changes if you want to try different things such as
// promting the user for credentials, etc.
static private string GetConnectionString()
// To avoid storing the connection string in your code,
// you can retrieve it from a configuration file.
return "Data Source=myserver.server.com;Persist Security Info=True;" +
// This will open the connection and query the database
static private void ConnectAndQuery()
string connectionString = GetConnectionString();
using (OracleConnection connection = new O
Obviously you want to show a message using MessageBox.Show(ConnectAndQuery());. However the Show-message expects a string a s parameter, but you assign a call to a method returning nothing (void). I assume you simply want to call the ConnectAndQuery-method and afterwards show any log-message: