How can I get one value from a select statement and put it into a string and then modify it in that same method? What I want to do is get the last branch number and increment by 1 and return that value. It will be a string value so I will need to get help B002. So I would want it to assign B003 as my return value. Also, I have to use the OleDbConnection.
public string GetNewBranchID()
{
String sql = "SELECT last.branchNo FROM Branch ORDER BY branchNo";
OleDbConnection connection = new OleDbConnection(GetConnString());
OleDbCommand cmd = new OleDbCommand(sql, connection);
OleDbConnection oConn = new OleDbConnection(sConn);
oConn.Open();
OleDbCommand oCmd = new OleDbCommand(sSQL, oConn);
OleDbDataReader oReader = oCmd.ExecuteReader();
while(oReader.Read())
{
Console.WriteLine("{0}",
oReader["branchNo"]);
}
}