Thursday, June 14, 2012 3:39 AM
Please forgive me if I have posted to the wrong forum, but can someone kindly point me to one or more code examples of an HTML5 Forms page accessing a SQL Server database? Please note that I am NOT referring to HTML5 Web Storage (i.e., localStorage and sessionStorage), Web SQL Database, or IndexedDB.
Thanks in advance for any assistance.
Friday, June 15, 2012 7:29 PM
Might this helps you
Please let me know if any further help
Shehap (DB Consultant/DB Architect) Think More deeply of DB Stress Stabilities
Friday, June 15, 2012 8:54 PM
Looks like Node.js to access MS SQL Server has been taken of.
You could get some idea by reading one of my old articles here:
Saturday, June 16, 2012 2:19 AMThanks for the link. However, as I mentioned in my orignal post, I am "NOT referring to ... Web SQL Database", which is what your link refers to. Web SQL database is an implementation of SQL on the client's machine. I am looking for sample code that connects an HTML5 Form page to a SQL Server 2008/2012 back-end.
Saturday, June 16, 2012 2:25 AMThanks for the link. However, I am looking for sample code that performs CRUD actions using SQL Server's native file format, rather than using XML.
Saturday, June 16, 2012 2:29 AM
The above link is NOT for a web SQL Database. Probably it was not for SQL Server 2008 or 2012.
I think you can still use ADO technology to connect to SQL Server from your page without using XML data islands.
Saturday, June 16, 2012 2:55 AM
Jayaram - The link I was referring to in my first response was the one posted by Shehap which does, in fact, talk about "Web SQL Database" (a client-side, pseudo implementation of SQL Server).
I am somewhat new to ASP.NET programming, and I currently access a SQL Server 2008 database using ASP.NET Web Forms (via Visual Studio's SqlDataSource), but I don't know how to access the same database using HTML5. Is there something comparable to SqlDataSource that I can use with HTML5's <input> element? Thanks.
Saturday, June 16, 2012 6:08 AM
Many years ago I published this article but it shows the general concept of how you go about connecting to SQL Server. This may be implemented as a button click on a form.
In order to return the same records using ADO, the properties CommandType and CommandText have to be appropriately set. The next code listing in the click event of a Command Button does exactly that as shown by the returned recordset that follows the code listing.
Private Sub Command0_Click()
'declare Connection, Command and RecordSet variables
Dim oConn As ADODB.Connection
Dim oCmd As ADODB.Command
Dim rst As ADODB.Recordset
'create new instances of the variables
Set oConn = New ADODB.Connection
Set oCmd = New ADODB.Command
'Open the connection
oConn.Open "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
"Persist Security Info=False; Initial Catalog=Northwind;" & _
'set the command's Active Connection
oCmd.ActiveConnection = oConn
'set the command's CommandText property
oCmd.CommandText = "Select CompanyName, City, Postalcode " & _
"from Customers where Country='Brazil'"
'set the Command's CommandType property
oCmd.CommandType = adCmdText
'execute the command for the Recordset
Set rst = oCmd.Execute
'get the three fields in CommandText by ordinal reference
Do Until rst.EOF
Debug.Print (rst.Fields(0).Value & " , " & _
rst.Fields(1).Value & " , " & _
rst.Fields(2).Value & vbCrLf)
- Marked As Answer by emerald77 Saturday, June 16, 2012 3:13 PM
Saturday, June 16, 2012 3:12 PM
Jayaram - Thanks for the link to your article. I was hoping to utilize something comparable to SqlDataSource rather than using ADO, but I will give your solution a try.
Thanks again for your help.