Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL Server 2000 and VB

Posted on 2004-10-20
6
Medium Priority
?
154 Views
Last Modified: 2010-05-02
I have a simple application that has a form with a datagrid, text, and command button.  The user can type in a SQL statement in the text box and get the results in the grid, then the user can update data in the table.  

The problem I ran into was if there are more than 1 record displayed in the grid everything works ok.  The user can update the data like an excel spread.  

But if there is only one record in the grid, and the user tries to update it, it acts like it works, but it is not really updating it.  If the user update the 1 record, then turns around and queries it again to see if the update worked, it never works.

Does some know why this would happen?  It this a datagrid control bug?  Or is this a SQL server bug/ weirdness?

 
0
Comment
Question by:strongd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
Michael_D earned 500 total points
ID: 12364404
It is not a bug.
By default datagrid updates DB when the current record changed.
when there is only one record (and I think that user not allowed add new rows) user cannot change the record and force datagrid update the DB.
The solution is simple: put a button on the form, name it "Update" and call  to your recordset's .Update method when pressed.

I hope it helps

Michael
0
 
LVL 10

Expert Comment

by:anv
ID: 12366462
what are the settings for the DataGrid u r using...??

'coz its working ine here even if  hve one record into it..
0
 

Author Comment

by:strongd
ID: 12370503
Here are the properties to the datagrid:   (I left out the obvious ones like FONT, COLOR, left , top, Row height, etc...)



AllowAddNew = True
AllowArros = True
AllowDelete = True
AllowUpdate = True
CausesValidation = True
ColumnHeaders = True
DataMember = NULL
DataSource = NULL
DefColWidth = 0
Enabled = True
HeadLine = 1
Index = NULL
Netgotiate = False
RighttoLeft = False
TabAcrossSplits = False
TabStop = True
TAG = Null
Visible = true
WrapCellPointer = False


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Expert Comment

by:Michael_D
ID: 12370611
Could you post the relevant code? How do you access Database?
0
 

Author Comment

by:strongd
ID: 12372109
I use a typical connection string...   I am also using the ADODC control ...

  Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & txtUserName.Text & ";password=" & txtPassword.Text & ";Initial Catalog=SysDB;Data Source=myserver"




Adodc1.ConnectionString = Connect
Adodc1.recordsource = 'SELECT * FROM My_TABLE"
   
  Set DataGrid1.DataSource = Adodc1

0
 

Author Comment

by:strongd
ID: 12372499
Thanks Mike D, I used your suggestion and added a button to the form with the recordset.update command...

It worked great...


Thanks again...

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question