Handling Local Database
Yeah I know it's C# but I guess it's easy to translate to VB .NET,,,,anyways...I'm trying to store some shit on a local database (Project->New...->Local Database), the point is that I get this error which says that I have to put a vaild Insert Command when calling the function SqlCeDataAdapter.Update()...
If somebody could help me that would be appreciated ![=]](/forum/images/emotions/=].gif)
http://screensnapr.com/v/xITQaD.png

Code:
private string Register(string[] args)
{
try
{
string user = args[0];
string password = args[1];
string dataSource = Environment.CurrentDirectory + "\\protected\\Users.sdf";
SqlCeConnection connection = new SqlCeConnection("datasource=" + dataSource);
connection.Open();
SqlCeDataAdapter adapter = new SqlCeDataAdapter("select * from Users", connection);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
int len = dataSet.Tables[0]****ws.Count;
for (int i = 0; i < len; i++)
{
if (dataSet.Tables[0]****ws[i].ItemArray[0] == user)
return "Error: Username is in use.";
}
Log.Info("Registering User With:\r\nUsername - " + user + "\r\nID - " + ((len+1) << 54).ToString());
dataSet.Tables[0]****ws.Add(new object[] { user, password, ((len+1) << 54), 0, 0, 0, "" });
adapter.Update(dataSet);
connection.Close();
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return "User registered!";
}
![=]](/forum/images/emotions/=].gif)
http://screensnapr.com/v/xITQaD.png
