Results 1 to 5 of 5

Thread: How to write a SQL statement in Visual Basic?

  1. #1
    Join Date
    Aug 2006
    Posts
    122

    How to write a SQL statement in Visual Basic?

    Hi friends,
    I have done many programs in Visual Basic as well as I have created database by using the SQL. But I am not having much knowledge about the using SQL statement in VB. So thought that you guys can explain me about it. Please tell me how to write a SQL statement in Visual Basic.?? Any other information regarding the topic would be appreciable.!!
    As you simplify your life, the laws of the universe will be simpler; solitude will not be solitude, poverty will not be poverty, nor weakness.Henry David Thoreau

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to write a SQL statement in Visual Basic?

    Normally, we create our applications using visual tools, without worrying about the SQL code generated. So they can respond to different situations, we can, in Access, to configure. Most often this is to refer to form controls. But if the setting is not on a form, or if the request is the source of a recordset, or if the form control is empty, then you are stuck. In such cases, alternative to this technique is to change dynamically in Visual Basic, part of the SQL query, SQL statement or a SQL expression in order to make variable.

  3. #3
    Join Date
    Nov 2005
    Posts
    1,323

    Re: How to write a SQL statement in Visual Basic?

    In Visual Basic we write, naturally, an SQL (or application) in a variable of type String. Many programmers only use data bound controls to access data. In a new project, references must be made to the ‘Microsoft DAO 3.51 Object Library (or later)’. This then gives you Database and Recordset objects to play with. The following is some code that defines variables for a Database and Recordset Object, so just have a look at that :
    Code:
    Dim PlayStation as Database
    Dim PlayGroup as Recordset
    Dim SQL as String

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: How to write a SQL statement in Visual Basic?

    Many times you need to write the value of a criterion. The need most often in the setting of an SQL statement, for the WHERE clause. This clause consists of criteria, where we will put the values which may come from a form, a variable VB, or VB expression. The SQL is the text, it will have to convert text values that do not. In addition, there are certain conventions to be respected for that engine database to recognize the values written literally.It must, first, recognize that the sequence of characters represents a value and not a field name or keyword.

  5. #5
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to write a SQL statement in Visual Basic?

    I want to tell you something about the numeric value. The numeric values must be written in U.S. format. The period (.) Is the decimal point and there is no separator for thousands. The integers are not concerned since there are no decimals. In Visual Basic it is necessary to convert numbers into text formatted. If you do not explicitly, Visual Basic will do for you. Also there are two constraints in writing values of type Date. They are written in U.S. date format and they are delimited (framed) by the pound character (#).

Similar Threads

  1. Option Explicit Statement from Visual Basic 6.0
    By Kusagra in forum Software Development
    Replies: 4
    Last Post: 28-11-2009, 10:05 AM
  2. How to write SQL statement to get all data
    By Paramartha in forum Software Development
    Replies: 3
    Last Post: 31-07-2009, 12:16 PM
  3. what are Visual Basic IDE?
    By Naresh Modi in forum Software Development
    Replies: 2
    Last Post: 06-03-2009, 09:49 AM
  4. Is GUI same like Visual Basic ?
    By Caesar in forum Software Development
    Replies: 2
    Last Post: 02-03-2009, 01:32 PM
  5. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,662,647.28330 seconds with 17 queries