Question about Microsoft Windows Vista Ultimate Edition

2 Answers

Printing syntax hello sir pleas send the visual basic 6.0 printing syntax and how to connect the databse in sql server

Posted by on

Ad

2 Answers

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Social Spider:

    An expert who has shared 50 answers on their Facebook wall.

  • Microsoft Expert
  • 43 Answers

Execute the following query

'Imports System.Data.SqlClient
Dim con As New SqlClient.SqlConnection
Dim strCon As String = "Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=SQLEXPRESS;Integrated Security=SSPI;Connection Timeout=10;" 'NT Authentication
'For SQL Authentication Dim strCon As String = "Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=DATABASENAME;User ID=USERNAME;Password=PASSWORD;Connection Timeout=50;"
Dim strCommand As String = "SELECT * FROM TABLE"
Dim command As SqlCommand
Dim da As SqlDataAdapter
Dim dt As New DataTable
Try
con.ConnectionString = strCon
command = New SqlCommand(strCommand, con)
command.CommandTimeout = 3000
da = New SqlDataAdapter(command)
da.Fill(dt)
MsgBox(dt.Rows.Count.ToString())
'FOR INSERT, UPDATE, DELETE, USE BELOW
'Dim count as Integer = command.ExecuteNonQuery()
'count is the affected row number
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
Finally
If con.State = ConnectionState.Open Then
con.Close()
End If
End Try

Posted on Jun 15, 2016

Ad
  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Vice President:

    An expert whose answer got voted for 100 times.

  • Master
  • 634 Answers

'declare the variables
Dim Connection
Dim ConnString
Dim Recordset
Dim SQL

'define the connection string, specify database driver
ConnString="DRIVER={SQL Server};SERVER=yourServername;UID=yourUsername;" & _
"PWD=yourPassword;DATABASE=yourDatabasename"

'declare the SQL statement that will query the database
SQL = "SELECT * FROM TABLE_NAME"

'create an instance of the ADO connection and recordset objects
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")

'Open the connection to the database

Connection.Open ConnString

'Open the recordset object executing the SQL statement and return records
Recordset.Open SQL,Connection

'first of all determine whether there are any records
If Recordset.EOF Then
Response.Write("No records returned.")
Else
'if there are records then loop through the fields
Do While NOT Recordset.Eof
Response.write Recordset("FIRST_FIELD_NAME")
Response.write Recordset("SECOND_FIELD_NAME")
Response.write Recordset("THIRD_FIELD_NAME")
Response.write "<br>"
Recordset.MoveNext
Loop
End If


'close the connection and recordset objects to free up resources
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing

Posted on May 25, 2009

Ad

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of.(from cars to computers, handyman, and even drones)
click here to download the app (for users in the US for now) and get all the help you need.
Goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

What is sql condition in visual basic?


sql is used for databases. Something like sql server, oracle, or access uses sql. It is a group of tables configured to reference eachother, so if you are programming in visual basic, you are trying to reference something on your sql server.

Feb 28, 2011 | Microsoft Xbox 360 Console

1 Answer

How many clients can connect using SQL server 2008 enterprise edition with VB 6.0


It would depend on your license for SQL Server... Then it would also depend on what your options are set to. You should have no problem easily allowing over 100, assuming connections are opened and closed properly and so on.

Nov 25, 2010 | Microsoft Visual Basic Enterprise Edition...

1 Answer

I install SQL server 2005 in vista os but when we create new sql server databse click then we find server name . please tell about server name


server name will be the same as your local computer name ( but if you have given a server name while installing the SQL S05 then ... ) give a try in menu tool on the top and select properties and check for sever

Oct 04, 2010 | Computers & Internet

3 Answers

Visual Basic and SQL


Hi,

Visual Basic 6.0 and MS Sql server 7 or 2000 are highly compatible with each other. VB.net is compatable with sql 2005 which is inbuilt as well.

Jul 07, 2009 | Microsoft Windows Vista Ultimate Edition

1 Answer

I am trying to connect to a SQL Server 2005 DB from Visual Studio


You must create an ODBC connection to your SQL database in the Windows Control Panel. Than you can call your ODBC connection via Visual Studio 2005. You can also create a DSN in Visual Studio 2005 and reference in that way. You will not be able to connect to an MDF but instead you have to connect to the SQL Server Service. Of course the username you use to connect must have access that will be created on the SQL server.

Apr 13, 2009 | Microsoft SQL Server 2005 Standard Edition

1 Answer

How do copy a table from an access database in one folder to another access database in another folder through visual basic code


Simple method Open both tables (or create second) and copy each record from source to target through 'do while not eof' or 'for each' syntax.

Second solution create link in target DB for first table, and use SELECT INTO statment in SQL.

Mar 02, 2009 | Microsoft Visual Basic 6.0 for PC

4 Answers

How get sql data backup


there is facility in enterprise manager to take back of database!

Feb 04, 2009 | Keystone Active Server Pages (ASP)/Visual...

1 Answer

I want connet foxpro databse to visiual basic


Using a DSN-less connection to open a free table
'
cn.Connect = "SourceType=DBF;" _
& "SourceDB=C:\Vfp\Samples\Data;" _
& "Driver={Microsoft Visual FoxPro Driver}"

Jan 20, 2009 | Computers & Internet

2 Answers

How to connevt visual basic with oracle(sql)


You need to install oracle client on client machine, and than you can use datasource (ODBC) to connect from vb to oracle.

Jan 23, 2008 | Computers & Internet

1 Answer

Installing SQL server and VB.NET on VISTA Home Basic


installl SQL SERVER 2005

Vb.net is fine its your sql that will mess things up

BTW visual studio come with an SQL server

Jan 09, 2008 | Microsoft Windows Vista Ultimate Edition

Not finding what you are looking for?
Microsoft Windows Vista Ultimate Edition Logo

224 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

micky dee

Level 3 Expert

2845 Answers

Piyal Perera
Piyal Perera

Level 3 Expert

528 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18402 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...