PC Review


Reply
Thread Tools Rate Thread

Binding to dynamic sql

 
 
John
Guest
Posts: n/a
 
      31st May 2009
Hi

I have a desktop db background and am new to sql server. How can I bind my
winform controls to a dynamic sql running on sql server backend db? The
reason I need dynamic sql is to give users maximum flexibility on ORDER BY
and WHERE clauses of the sql.

Many Thanks

Regards


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      31st May 2009
John,

In code, but as the designer does it for different controls different you
have to do it as well different, there are four types.

Labels, Textboxes, DateTime and more of those once box controls with that
you use in the control the property databindings
http://msdn.microsoft.com/en-us/libr...abindings.aspx

For the Listbox, the Combobox, the DataGridView and the Datagrid it is
the datasource while those are for the first two different from the latter
two.

But that is easy to find.

Cor



"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have a desktop db background and am new to sql server. How can I bind my
> winform controls to a dynamic sql running on sql server backend db? The
> reason I need dynamic sql is to give users maximum flexibility on ORDER BY
> and WHERE clauses of the sql.
>
> Many Thanks
>
> Regards
>
>


 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      31st May 2009
Hi John,

Your problems can be divided into two parts.
1. dynamic sql. you should really check out docs on ado.net (or perhaps Linq
to SQL, Entity Framework...) and understand that it uses a disconnected
approach - load data in memory, modify it, send back to server. You can't
bind controls directly to server. Dynamic SQLs aren't hard to execute, just
watch out for sql injection.
2. binding. If you create a strong typed dataset in your project the binding
is pretty much trivial - just drop the dataset instance on the form and do
the binding.

You should search for the terms above in the help files...

HTH,
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have a desktop db background and am new to sql server. How can I bind my
> winform controls to a dynamic sql running on sql server backend db? The
> reason I need dynamic sql is to give users maximum flexibility on ORDER BY
> and WHERE clauses of the sql.
>
> Many Thanks
>
> Regards
>
>

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      31st May 2009
Cor & Miha

Many thanks. Pretty familiar with binding/datasets in MS Access environment.
Trying to move to sql server back end. What I am wondering is how to cerate
and pass the dynamic sql to sql server in the first place and then grab back
the resultset from sql server which I can use for binding? Sorry if its a
dumb question, really first time trying to do this with sql server.

Many Thanks

Regards

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have a desktop db background and am new to sql server. How can I bind my
> winform controls to a dynamic sql running on sql server backend db? The
> reason I need dynamic sql is to give users maximum flexibility on ORDER BY
> and WHERE clauses of the sql.
>
> Many Thanks
>
> Regards
>
>



 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      1st Jun 2009
Hi John,

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Cor & Miha
>
> Many thanks. Pretty familiar with binding/datasets in MS Access
> environment.


That is something completly different.

> Trying to move to sql server back end. What I am wondering is how to
> cerate and pass the dynamic sql to sql server in the first place and then
> grab back the resultset from sql server which I can use for binding? Sorry
> if its a dumb question, really first time trying to do this with sql
> server.


It is not a dumb question but rather a beginner's one. There is a ton of
resource online, such as this one:
http://asp.dotnetheaven.com/howto/do...ataFromDB.aspx
Basically you have to learn ado.net. A good starting point is reading .net
documentation as well as it explains the basics pretty well.

HTH,
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      1st Jun 2009
Miha, I meant I have used ado.net with access as backend. Now moving to sql
server, just wondering how dynamic sql can be used with sql server as
backend. Do any of the sql server features help in the original requirement
I posted?

Many Thanks

Regards

"Miha Markic" <miha at rthand com> wrote in message
news:EA5D3B84-BB00-4EFF-BC08-(E-Mail Removed)...
> Hi John,
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Cor & Miha
>>
>> Many thanks. Pretty familiar with binding/datasets in MS Access
>> environment.

>
> That is something completly different.
>
>> Trying to move to sql server back end. What I am wondering is how to
>> cerate and pass the dynamic sql to sql server in the first place and then
>> grab back the resultset from sql server which I can use for binding?
>> Sorry if its a dumb question, really first time trying to do this with
>> sql server.

>
> It is not a dumb question but rather a beginner's one. There is a ton of
> resource online, such as this one:
> http://asp.dotnetheaven.com/howto/do...ataFromDB.aspx
> Basically you have to learn ado.net. A good starting point is reading .net
> documentation as well as it explains the basics pretty well.
>
> HTH,
> --
> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
> RightHand .NET consulting & development www.rthand.com
> Blog: blog.rthand.com



 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      1st Jun 2009
John,

What you know from OleDB and Access is almost the same for SQLClient.SQL.

This is by instance about databinding

The main difference is that there is for SQL more and that you will use in
SQL probably more related tables.

With those related tables there starts the pain

But in my idea, simple start, to begin there is not much more different then
that the ? is in SQL a named parameter, but handled in the same way, and
those named parameters works in SQL easier then in OleDB.

Cor
..


"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Cor & Miha
>
> Many thanks. Pretty familiar with binding/datasets in MS Access
> environment. Trying to move to sql server back end. What I am wondering is
> how to cerate and pass the dynamic sql to sql server in the first place
> and then grab back the resultset from sql server which I can use for
> binding? Sorry if its a dumb question, really first time trying to do this
> with sql server.
>
> Many Thanks
>
> Regards
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi
>>
>> I have a desktop db background and am new to sql server. How can I bind
>> my winform controls to a dynamic sql running on sql server backend db?
>> The reason I need dynamic sql is to give users maximum flexibility on
>> ORDER BY and WHERE clauses of the sql.
>>
>> Many Thanks
>>
>> Regards
>>
>>

>
>


 
Reply With Quote
 
John
Guest
Posts: n/a
 
      1st Jun 2009
Cor, thanks. Is there a link of this that I can see?

Thanks

Regards

"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> John,
>
> What you know from OleDB and Access is almost the same for SQLClient.SQL.
>
> This is by instance about databinding
>
> The main difference is that there is for SQL more and that you will use in
> SQL probably more related tables.
>
> With those related tables there starts the pain
>
> But in my idea, simple start, to begin there is not much more different
> then that the ? is in SQL a named parameter, but handled in the same way,
> and those named parameters works in SQL easier then in OleDB.
>
> Cor
> .
>
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Cor & Miha
>>
>> Many thanks. Pretty familiar with binding/datasets in MS Access
>> environment. Trying to move to sql server back end. What I am wondering
>> is how to cerate and pass the dynamic sql to sql server in the first
>> place and then grab back the resultset from sql server which I can use
>> for binding? Sorry if its a dumb question, really first time trying to do
>> this with sql server.
>>
>> Many Thanks
>>
>> Regards
>>
>> "John" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi
>>>
>>> I have a desktop db background and am new to sql server. How can I bind
>>> my winform controls to a dynamic sql running on sql server backend db?
>>> The reason I need dynamic sql is to give users maximum flexibility on
>>> ORDER BY and WHERE clauses of the sql.
>>>
>>> Many Thanks
>>>
>>> Regards
>>>
>>>

>>
>>

>



 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      2nd Jun 2009
No simply try it with an SQL Express or compact database, create in that
your table and change by edit quick-change everywhere OleDB.OleDB in
SQLClient.Sql although you can even use that OleDB.OleDB on an Sql server,
but that is inefficient.

Don't forget to change the connection string and more things like that to
the SQL express database.

Cor

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Cor, thanks. Is there a link of this that I can see?
>
> Thanks
>
> Regards
>
> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> John,
>>
>> What you know from OleDB and Access is almost the same for SQLClient.SQL.
>>
>> This is by instance about databinding
>>
>> The main difference is that there is for SQL more and that you will use
>> in SQL probably more related tables.
>>
>> With those related tables there starts the pain
>>
>> But in my idea, simple start, to begin there is not much more different
>> then that the ? is in SQL a named parameter, but handled in the same way,
>> and those named parameters works in SQL easier then in OleDB.
>>
>> Cor
>> .
>>
>>
>> "John" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Cor & Miha
>>>
>>> Many thanks. Pretty familiar with binding/datasets in MS Access
>>> environment. Trying to move to sql server back end. What I am wondering
>>> is how to cerate and pass the dynamic sql to sql server in the first
>>> place and then grab back the resultset from sql server which I can use
>>> for binding? Sorry if its a dumb question, really first time trying to
>>> do this with sql server.
>>>
>>> Many Thanks
>>>
>>> Regards
>>>
>>> "John" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hi
>>>>
>>>> I have a desktop db background and am new to sql server. How can I bind
>>>> my winform controls to a dynamic sql running on sql server backend db?
>>>> The reason I need dynamic sql is to give users maximum flexibility on
>>>> ORDER BY and WHERE clauses of the sql.
>>>>
>>>> Many Thanks
>>>>
>>>> Regards
>>>>
>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
Sreenivas
Guest
Posts: n/a
 
      2nd Jun 2009
On May 31, 7:40*am, "John" <i...@nospam.infovis.co.uk> wrote:
> Hi
>
> I have a desktop db background and am new to sql server. How can I bind my
> winform controls to a dynamic sql running on sql server backend db? The
> reason I need dynamic sql is to give users maximum flexibility on ORDER BY
> and WHERE clauses of the sql.
>
> Many Thanks
>
> Regards


I would recommend you to read Erland's article
http://www.sommarskog.se/dynamic_sql.html
of Dynamic SQL , before you proceed to the same.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example of dynamic binding for GridView Lloyd Sheen Microsoft VB .NET 5 17th Dec 2008 01:53 PM
dynamic sitemap binding. carlos Microsoft ASP .NET 1 10th Jul 2008 09:54 PM
Dynamic Data-binding in C# Fir5tSight Microsoft Dot NET 2 21st Jul 2006 07:03 PM
Dynamic event binding Gerard Microsoft Dot NET Compact Framework 3 18th May 2006 05:18 PM
Dynamic two-way data binding AM Microsoft ASP .NET 0 21st Apr 2006 04:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:53 AM.