473,320 Members | 2,111 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,320 software developers and data experts.

Totally Lost and frustrated: visual studio c# 2005 sql database interaction

I have created a new project. and within this project as per the
tutorial created an sql database.

i have made a query which returns the result i need.

1. I cant SAVE THE QUERY? where on earth is the option to save a query?

2. How do i run an sql query from within c# ? i have a command button i
want to enter code for the command button that will run an sql query...
how do i do it?

thanks, im so frustrated with vs at the moment, the help doesn't even
work on my machine but it just says nothing can be found...

help please./

Gary.

Nov 17 '05 #1
6 1430
Gary,

What do you mean you want to save the query? If you are using the
designer in VS.NET 2005, it stores your query in the designer-generated
code.

You can also create a stored procedure, and call that, and your query
will be in the database.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ga********@myway.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I have created a new project. and within this project as per the
tutorial created an sql database.

i have made a query which returns the result i need.

1. I cant SAVE THE QUERY? where on earth is the option to save a query?

2. How do i run an sql query from within c# ? i have a command button i
want to enter code for the command button that will run an sql query...
how do i do it?

thanks, im so frustrated with vs at the moment, the help doesn't even
work on my machine but it just says nothing can be found...

help please./

Gary.

Nov 17 '05 #2
thanks for your reply please help some more
i can see four windows
1 - picture of table
2 - grid with columns in
3 - sql code
4 - returned result

i put my sql code in the 3rd window, and vs studio put some spaces in
and put split it up over a couple of lines, when i run it the result
appears in window 4.

I want to run this when a button on my form is pressed. I can't find
any designer-generated code you mention? how do i run this query from
within my c# code, attached to my command button on my form.

thank you

gary

Nov 17 '05 #3
to elaborate a bit ...

my form consists some text boxes that i dragged from the 'data sources'
window.

when i press my command button i want to run the query so that only the
returned record appears on this form, and not all of the records in the
database.

also the query i run returns the name of a field, i would like to store
this in a variable called result$ when the query is run.

thanks

gary.

Nov 17 '05 #4
Gary,

You should have a file in your C# project which represents the data set
that is the result of that query. In that designer file, you should see the
data adapters which are configured to run your query.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ga********@myway.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
thanks for your reply please help some more
i can see four windows
1 - picture of table
2 - grid with columns in
3 - sql code
4 - returned result

i put my sql code in the 3rd window, and vs studio put some spaces in
and put split it up over a couple of lines, when i run it the result
appears in window 4.

I want to run this when a button on my form is pressed. I can't find
any designer-generated code you mention? how do i run this query from
within my c# code, attached to my command button on my form.

thank you

gary

Nov 17 '05 #5
I have foudn a file called: betadataset.designer.cs

the table i'm using is called beta, so i think this might be the file
you reference.
I can double click this file and code is displayed.

I tried to copy all of this and paste it to the code that appears when
i double click on the button on my form, but that seems to have made
things worse, and now my form doesn't display properly.

I don't seem any closer to achieving what I need to achieve.
I have a form. This form displays records from my table. I have dragged
and dropped the text boxes to display the records onto the form, from
the data source window. When i run my app the records are displayed
fine.
All i want to do is add a button, that runs an sql query so that only
the records that match the query are displayed!!!??!

please how do i do this?

Nov 17 '05 #6
Gary,

There is no reason to cut and paste this. Those classes are available
to you, you just have to make sure that you have the right namespace and
type name. You should note that some of the table designer classes are
actually nested classes (although I think it is the tables themselves, and
the table adapters, I forget).

All you have to do is get the data adapter with your query, and then run
it. The class is in there somewhere. Look for something with
"TableAdapter" in it's name.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ga********@myway.com> wrote in message
news:11********************@f14g2000cwb.googlegrou ps.com...
I have foudn a file called: betadataset.designer.cs

the table i'm using is called beta, so i think this might be the file
you reference.
I can double click this file and code is displayed.

I tried to copy all of this and paste it to the code that appears when
i double click on the button on my form, but that seems to have made
things worse, and now my form doesn't display properly.

I don't seem any closer to achieving what I need to achieve.
I have a form. This form displays records from my table. I have dragged
and dropped the text boxes to display the records onto the form, from
the data source window. When i run my app the records are displayed
fine.
All i want to do is add a button, that runs an sql query so that only
the records that match the query are displayed!!!??!

please how do i do this?

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gernot Frisch | last post by:
Hi, I get these errors, but I'm totally lost. It's a large cpp file and I don't know where to search for the error, since it does not point to any of my code lines. Can someone suggest where to...
10
by: Lauren Wilson | last post by:
Ok I have searched the MS website for info on this. I am totally confused. If I want to deploy an Access 2003 app and allow my users to run it using Access 2003 Runtime, where do I get the...
2
by: mchamsters | last post by:
Just want to rant about something horrible that happened to me tonight. It was my first time using the new Visual C#. I started a new project, coding away continuously for about 6 hours. I saved...
1
by: Philip Leduc | last post by:
Hi there, I am a MS Access VBA programmer trying to get my feet wet using VB.net / SQL server. I have SLQ 2000/visual studio 2003 loaded and did get a SQL2005/visual studio 2005 software...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
3
by: Edwin Smith | last post by:
I have a 2 form project in VS2005 that now hangs whenever I try to do anything with the second form. This seems to have started when I added some SQL tables from a Pervasive v.9 database using the...
1
by: bharathreddy | last post by:
This Article gives an introduction to VSTS Team Foundation & fundamental difference between Visual Source Safe (VSS) and VSTS Team Foundation. Team Foundation is a set of tools and technologies...
1
by: Dr T | last post by:
Hi! I downloaded MS Visual Web Developer 2005 Express Edition, MS .NET Framework SDK v2.0, and MS SQL Server 2005. Subsequently, I bought MS Visual Studio 2005 Professional Edition. 1) Are...
0
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
Last week I asked a question about connection to database from client machine (developer machine). There are two types of security setup for SQL Server database: Windows only and "SQL Server and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.