If I use javascript in my pages, can I still use ADO to connect to SQL server?

I'm not exactly sure what I'm doing here.  (I'm sure it shows)  I want to start using javascript and ajax in my ASP.net pages, but am currently using ADO (I think) to communicate with my SQL server.  Here's a sample script..

  Dim objConn As New SqlConnection(ConfigurationSettings.AppSettings("DSN"))
 Dim objCmd As SqlCommand
 Dim objRdr As SqlDataReader

 Sub LoadMenubar()
  Try
   objConn.Open()
   objCmd = New SqlCommand("SELECT * FROM Menubar ORDER BY Priority", objConn)
   objRdr = objCmd.ExecuteReader()
   rptMenu.DataSource = objRdr
   rptMenu.DataBind()
   objRdr.Close()
   objConn.Close()
  Catch
   Response.Redirect("Error.aspx?ErrorCode=1026-1-1")
  End Try
 End Sub

Is this ADO or is this VisualBasic?  How would I do this if I were using javascript; I am under the impression that I can't use both javascript and VB.

0
Nashua
3/24/2009 1:24:43 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
734 Views

Similar Articles

[PageSpeed] 48

Nashua:
Is this ADO or is this VisualBasic? 
 

ADO is a set of Component Object Model (COM) objects for accessing data sources . That means the code above accesses the database (ADO/ADO.NET) using the (VB/VB.NET) code.

Nashua:
  How would I do this if I were using javascript;
 

You can't, Javascript is used for client side scripting and not for accessing data from the DB.. Javascript runs in the clients browser, your database is exposed by the server.  There's disconnected space between them.

However, you can connect Javascript to a webservice, and inside the webservice you can return data from your database to the javascript method. 

Nashua:
I am under the impression that I can't use both javascript and VB.
 

You can use both of them in your codes.. please note that JavaScript and VB are two different things.. Use JavaScript for client side manipulations and use VB/VB.NET for code behind manipulations..


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
3/24/2009 3:07:48 AM
Reply:

Similar Artilces:

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

Why use parts of Ado.net when you can use SQL
Just on this line of thought. Why use objects such as DataTable,DataRow,DataColumn when you can use SQL to select and insert data more effectively. I have been creating applications that use sql queries and stored procedures. The other way to do it would be to use ADO.nets objects that help you like DataTable,DataRow, DataColumn. I hardly ever use them at all so are they really worth going into in depth. I prefer SQL to do all my data manipulation.MCAD.Net vb.net Perhaps you should explain how you use sql queries and stored procedures and how you think they're more effective. I f...

can't connect to sql server database with same connection used in visual studio .net 2003
I have the following code that works fine in visual studio .net 2003 but not with VWD.  I have sql server 2000 developer edition installed locally and this connection works fine with visual studio.  With VWD it fails with the exception "System.Data.SqlClient.SqlException: Login failed for user 'DARRELL\ASPNET'".  It fails on the conn.Open line.   any ideas on what the issue is?Dim conn As SqlConnectionDim connstr As Stringconnstr = "Data Source=DARRELL;Initial Catalog=Event;Integrated Security=SSPI;"Dim daEvents As New SqlDataAdapter("select * from events", connstr...

How can I use javascript in a page that uses master page?
How can I use javascript in a page that uses master page? my page is uses master page. Therefore it has not Header, Body section. If I want to use javascript in this page, how can I do that? Thanks You can place a ContentPlaceHolder on the master page within the Head section. Then in each content page you want to include some Javascript, you can add the include javascript file in Content holder. This way, you added a jsvsacript file in the head of the page!! Got the solution? RegardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP Hi haidar_Bilal, Have you sample? Tha...

Error while connect to SQL Server using ADO control
The following error happens in my ASP.NET page from time to time. It will disappear after I restart the SQL Server. I guess I messed up in the garbage collection, but I really don't know what to do except using "conn=nothing" statement, can anyone help me with this? Thanks!   [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtim...

Not able to connect to SQL SERVER using ADO.NET
Hi, I am trying to connect to SQL SERVER 2000using VS.Net 2003.I ve configured my LOCAL sql sever to use windows authentication(in enterprise manager) Ths is the connection string i use in ADO.net for connection to the database 'test' in the local server.server=(LOCAL);integrated security = SSPI;database=test;1)This gives the following  error...."Login failed for <user name\ASPNET>"2)Also enteprise manager did not allow me to use sql server authentication.Please helpSat Have you added ASPNET as a user in the database? Hi Satishr23. It is possible that your log-in ac...

Security Error connecting to SQL Server using ADO.net
In our environment, we can successfully connect to SQL server using ADO.net interface, but when we delivered the software to clients, they are having connection errors. Connection parameters all look good. I am not sure what this error is about and unfortunately, the error does not tell much. Thanks in advance for helping me out Below are the details of the error Initial Connection Error Trans Error Code: -1 DBErrorCode:999 DBMS: ADO.Net DB Error Message: System.Security.SecurityException:Request failed. at Sybase.PowerBuilder.Db.Block.OleDbBlock.Connect(String cnnStr,...

Using ADO to connect to SQL Server 2005 or 2008 (Express and standard) using Windows Authentication
Hi, I apologize in advance if this is an overly simple question or I have simply overlooked the obvious. With the current project (it's client server not n-tier) I'm on, we usually connect using SQL Server authentication. We now have a customer that would like to us to connect to SQL server using Windows Authentication. The customer would like to control all access to SQL server using Active Directory rather than us having the username and password on the client side connecting via SQL Server Authentication. The app is still in D5 (don't ask ;) ), with all t...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

Modifing javascript to use server controls instead of using html controls
Hi, I use a Javascript to create a textbox that converts English to Hindi text. I am using it in my aspx pages. I use another javascript to access the Text of this HTML textbox.  Everything is fine when I use Single TextBox on a page. But the complexities go out of my control when i need to use 5 such textboxes on the same aspx page. Moreover I encounter issues of ID of ASP.NET controls that get changed as there are ContentPlaceHolders, TabPanels etc. I don't know the javascript things so deeply that I can comprehend the code that generates the custom Textbox. Now I ne...

Cannot connect to SQL Server database using ado.net after IP address has changed
Dear all, I wasn't able to connect to my SQL server 2000 database (which reside in the network in a windows 2003 server) after the IP address of the server has changed and the server is shut down, moved and re-started. I was able to connect to this server by using ADO using VB. I was able to register this server in my EM and was able to create ODBC connection. Just when using ADO.NET, I wasn't able to connect. Any ideas? Will there be any caching within ADO.NET still pointing to the old IP address? Thank you for all the help in advance. There are a lot of variable possibilites her...

PB 10.2.0 Connect SQL Server Using ADO.NET Provider
I have a problem with connection to SQL Server database using ADO.NET after upgrading to PB10.2.0 build 8011 runtime on the client machine. But it worked fine in version 10.0.1 build 6044 . Anyone can help me to figure ot that problem? TIA. John Ho. Can you try to provide details of the problem? <John Ho> wrote in message news:427aeaa1.7f95.1681692777@sybase.com... >I have a problem with connection to SQL Server database > using ADO.NET after upgrading to PB10.2.0 build 8011 runtime > on the client machine. But it worked fine in version 10.0.1 > build 604...

HELP: Connecting using 10.5 w\MS SQL Server\ADO.NET
Hello, I was able to establish a connection using ADO.NET from within PowerBuilder, but when I try to run the application, on the login I am being asked for a Data Source. Is there something in the .ini file that needs to be tweaked. Here is a sample of what PowerBuilder 8.0 uses: [Mod] DBMS=MSS Microsoft SQL Server 6.x Database=pdat_1011 UserId= DatabasePassword= LogPassword= ServerName=denison03 LogId= Lock= DbParm= Prompt=0 dbstatus=Model Office Section 1011 ArchiveFile="" Thanks, LaChandra In the db-profile check out the preview tab. That tells you ...

The connection to the server was reset while the page was loading
I have this problem with this download functionality. I'm using a drop down list, and when the user selects an item in that list (selectedindexchanged), a repeater control is automatically binded with the datasource and the repeater is nested in an update panel so no full post back occurs.   The problem is some downloads in the drop down list will not work but others will. The ones that don't work says "The connection to the server was reset while the page was loading," and in IE it just says "Internet Explorer cannot display the web page "   I ...

Web resources about - If I use javascript in my pages, can I still use ADO to connect to SQL server? - asp.net.presentation-controls

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

JavaScript - Wikipedia, the free encyclopedia
programming styles. JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
... editor - report abuse/spam - help the entire directory only in Tools/Obfuscators Description Top : Computers : Programming : Languages : JavaScript ...

Facebook File-Transfer App Pipe Relaunches, Now Works Via JavaScript, WebRTC
... allowed Facebook users to send and receive files up to 1 gigabit in size. A new version of Pipe debuted Monday, and the app now works via JavaScript ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

JavaScript
The Facebook SDK for JavaScript provides a rich set of client-side functionality for adding Social Plugins, making API calls and implementing ...

Senior Front-End Developer (Javascript and AJAX)
Company: Sometrics Category: Software Development Location: Los Angeles, CA How to Apply: jobs@sometrics.com Description: We are looking for ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 1/17/2016 9:48:11 AM