Showing posts with label ado. Show all posts
Showing posts with label ado. Show all posts

Sunday, February 26, 2012

Error Message with Recordset.Update

Hi,

I am converting a VB6 application to C# using ADO. I have the following code:

private ADODB.Connection cn = new ADODB.Connection();
private ADODB.Recordset rs = new ADODB.Recordset();

private connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source= " + stdDir;
strClientSQL = "SELECT * FROM Client ORDER BY casename, renldate, product, fundingcode";

cn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
cn.Open(Utilities.connectionString,null,null,0);

rs.CursorLocation = ADODB.CursorLocationEnum.adUseServer;
rs.Open(strClientSQL,cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic,-1);

rs.Fields["CaseName"].Value = this.txtCaseName.Text;

rs.Fields["CaseNo"].Value = this.txtCaseNumber.Text;

rs.Update();

When I try to compile and run it I get the following error message:

"No overload for method 'Update' takes '0' arguments"

I am not sure if I need to enter information in the update command or do something else. This seems pretty straight forward but I can't figure out how to do it. Can someone please help me?

Thanks,

Mark

The thing is that you have to place the fieldas and its values in the function, like this:

rsMsg.Update("Field1,Field2,Field3", "Value1,Value2,Value3");

But i supossed that you want to update the whole recordset, am i rigth?
That's a good question.... give me some time to answer that.

Hugo|||try without the parenthesis

rs.Update

Error Message with Recordset.Update

Hi,

I am converting a VB6 application to C# using ADO. I have the following code:

private ADODB.Connection cn = new ADODB.Connection();
private ADODB.Recordset rs = new ADODB.Recordset();

private connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source= " + stdDir;
strClientSQL = "SELECT * FROM Client ORDER BY casename, renldate, product, fundingcode";

cn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
cn.Open(Utilities.connectionString,null,null,0);

rs.CursorLocation = ADODB.CursorLocationEnum.adUseServer;
rs.Open(strClientSQL,cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic,-1);

rs.Fields["CaseName"].Value = this.txtCaseName.Text;

rs.Fields["CaseNo"].Value = this.txtCaseNumber.Text;

rs.Update();

When I try to compile and run it I get the following error message:

"No overload for method 'Update' takes '0' arguments"

I am not sure if I need to enter information in the update command or do something else. This seems pretty straight forward but I can't figure out how to do it. Can someone please help me?

Thanks,

Mark

The thing is that you have to place the fieldas and its values in the function, like this:

rsMsg.Update("Field1,Field2,Field3", "Value1,Value2,Value3");

But i supossed that you want to update the whole recordset, am i rigth?
That's a good question.... give me some time to answer that.

Hugo|||try without the parenthesis

rs.Update

Wednesday, February 15, 2012

Error Message "Could not find server 'FLDB1' in sysservers....

I'm getting the following message from a VB6 program running ADO...

It will process a job then I get the message.... [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find server 'FLDB1' in syssservers. Execute sp_addlinkedserver to add the server to sysservers...

This started to happen after I moved the db from SS2000 to SS2005...

Our db server and sql server instance on that server are both named 'FLDB1'... Do I need to run the above execute sp_addlinkedserver command on the new 2005 server?

Thanks-Dave

Yes, that would be necessary since you most likely didn't migrate the list of linked servers.

Error message

I'm creating a vb application which uses ADO on an SQL 2000 db. I went through all the steps of configuring my ado control but when i try to set my data field in my text box for my table named orders I get the following error:

Invalid Object Name "orders"

How do i fix this?Has anyone found a way to fix this?