473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Showing a sql query result

347 100+
I have the following code in my project:

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim connectionString As String
  3.         Dim cnn As SqlConnection
  4.         Dim myCommand As SqlCommand
  5.         'the connection string to the SQL server'
  6.         connectionString = "Data Source=10.2.1.41;Initial Catalog=MDR;uid=sa;password=chili123"
  7.         cnn = New SqlConnection(connectionString)
  8.         cnn.Open()
  9.         'the SQL query'
  10.         myCommand = New SqlCommand("select payrolldate from payroll where payrolldate <= getdate (), select dateadd (day, 7, Getdate())")
  11.         cnn.Close()
  12.         Dim ButtonDialogResult As DialogResult
  13.         ButtonDialogResult = MessageBox.Show("The next date available to you is", "Payroll", MessageBoxButtons.YesNo)
  14.         If ButtonDialogResult = Windows.Forms.DialogResult.Yes Then
  15.             Button2.Enabled = True
  16.             Button1.Enabled = False
  17.         End If
  18.     End Sub
  19. End Class
  20.  
And what I'm needing to do is to show in my messagebox.show the date from the sql query that I ran before this. I know that I havent declared a variable in that statement but I'm having a bit of a lapse today and was just wondering how to show that result in my messagebox.show.

Thanks

Doug
Aug 17 '10 #1
0 943

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lin Ma | last post by:
Greetings, In my search application, user can type a number to search. I use LIKE in my query. If a query result generates over 10,000 recordsets, it may several minutes to run. Is there a...
11
by: Surajit Laha | last post by:
I am firing a query like: SELECT TaskName, StartDate FROMTasks WHERE StartDate >= '01-Aug-2003' Now the result comes as: TaskName StartDate -------------------------- Task1 ...
2
by: Wei Wang | last post by:
Hi, I want to do a select in dynamic command, something like: TRIGGER FUNCTION DECLARE table_name_suffix text; temp_result RECORD; temp_result2 RECORD;
2
by: Martin Sarsale | last post by:
Dear All: Im looking for solutions (Free Software is better) to do query result caching. Thanks to the people from #postgresql I know that postgres doesn't do that by himself and the solution...
1
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. ...
1
by: Colin Clark | last post by:
Hello, I have a database of scores for a sports club. I want to display a continuous subform showing a person's scores for the season along with a running calculation based on those scores (the...
7
by: Muddasir | last post by:
i am having problem in printing the query result from MySQL db... actually i am developing a very simple search module. when the user select category from the given categories in drop down...
1
by: CCHDGeek | last post by:
How can I tell if a query result empty (ie there are no records with the specified criteria). I want to change a form's design based on the result of the query it is based how. Does anyone know how...
1
ddtpmyra
by: ddtpmyra | last post by:
how can I capture the query result in PHP? I have two queries below: # Fetch the file information $query ="update filestorage set approved ='Y' where FileID = {$id}"; $query1 ="select...
2
by: reeba | last post by:
I want to store the query result, in an servlet, into an xml file and display the contents of the xml file on the browser...... my code is as follows: public void doPost(HttpServletRequest...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.