Saturday, March 31, 2012
Submitting data to sql
this is what I have for my submit button
Me.txtprocess.Text.Insert()
all I am trying to do is when a user puts an entry in and click submit the entry is written over to a sql table.
Thanks in advanceJust do something like...
Dim strSQL As String ' SQL Statement
Dim cmd As New SqlClient.SqlCommand ' SQL Command
Dim strSubject As String ' Subject String
' Set the SQL connection to use for SQL Command
cmd.Connection = New SqlClient.SqlConnection("Persist Security Info=False;server=MyServer;database=MyDB;User ID=sa;Password=MyPassword")
' Add neccessary parameters to the SQL Command
cmd.Parameters.Add("@.MyData", txtMyData.Text)
' SQL UPDATE Statement
strSQL = "INSERT INTO MyTable (MyColumn) Values (MyData)"
' Try to catch any exceptions
Try
' if the SQL Connection is closed, open it
If SqlConn.State = ConnectionState.Closed Then
SqlConn.Open()
End If
' Set the SQL Command SQL Statement
cmd.CommandText = strSQL
' Execute the SQL Insert or Update
cmd.ExecuteNonQuery()
' Catch any exceptions
Catch ex As Exception
' Finally if it excepts or not
Finally
' If the SQL Connection is open, close it
If SqlConn.State = ConnectionState.Open Then
SqlConn.Close()
End If
End Try
submitting the form to the browser
Thank you
olaHi ola,
Unfortunately, there is no other technology that will help you with this issue. You are correct in that the brower uses "pull" technology and therefore there is nothing you can do on the server side to initiate this refresh. The only solution is to use client-side script to refresh the borwser.
Chad
Hi ola,
unfortunately a browser only supports the pull way. But maybe this article can be of help to you:Using IE's Web Service Behavior To Create Rich ASP.NET Applications. I know the next version of ASP.NET uses something like client call back functionality that's able to only update small portions of a page without refreshing the whole page.
Of course using this technique still requires to call a method on a time interval.
Grz, Kris.
Chad,
thank you very much for your reply.
I have additional question. When you refer to a client-side script that can be used to refresh a browser, are you talking about a separate program running on the same machine where the browser is open, or it is something incorporated into the web form code that does it on a timely bases? If it was a separate program (which could know which instance of the browser I need to refresh, which form on that instance of the browser is open and how to envoke the refresh on the browser), it would probably work for me. I will just need to find out how to do it (if at all it is possible). Do you know anything about it? Any ideas/suggestions?
Thank you
ola
ola,
I was actually talking about using a JavaScript timer or using the Meta tags to refresh the browser. I think it would be nearly impossible to write a Windows app to know which browser to refresh when. This would be way more work than it's worth. I think your only solution here is to just put code in your page to refresh the entire page every so often. Sorry I don't have the perfect solution for your problem.
Chad
Subscript out of range
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 0]'
/KnowledgeBase/sos-kb.inc.asp, line 82
And here are the lines of code in question:
Line 80 Dim CurrentDomain, AuthInfo
Line 81 AuthInfo = Split(Request.ServerVariables("LOGON_USER"), "\", -1, 1)
Line 82 CurrentDomain = AuthInfo(0)
The site was working absolutely fine and for some reason, one day, it just stopped loading.
Any help would be appreciated.Uhm... when you load it in IE, view source. Do you see anything?
What have you recently changed?
Wednesday, March 28, 2012
subtracting queries
The results of both queries have a common field, PlayerId.
query1 (select PlayerId, FirstName, LastName from Table1 where ....)
query2 (select PlayerId from Table2 where ....)
Thanks
RamilaYou could do a negation on an IN or Exists query for example:
Select PlayerID, FirstName, etc... FROM Table1 WHERE PlayerID Not IN(Select PlayerID from Table2...)
Monday, March 26, 2012
Suggestion needed for huge DataGrid
Our web site uses 3-tier structure, the middle tier is a web service. We
also use Microsoft Data Access Application Block to access sql server.
Now I have to display a DataGrid with huge amount of data on web page,
of course the DataGrid has pager. But even though, the web service still
will return full DataSet to web server, and let web server to handle pages.
Since Microsoft Data Access Application Block does not support
SqlDataAdapter.Fill(DataSet, startReocrd, maxRecord, tableName) to reduce
the size of DataSet. Do you think there is a better way to improve
performace?
Yes, I can always extend Microsoft Data Access Application Block and
build my own pager.
--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours HardyHi Hardy,
May I suggest two solutions:
-if the full set of lines is going to be requested sooner or later, fill the
DataSet and place it in the Cache for the first time, then read it from the
Cache.
-if you don't need the full set of lines, you may use the SqlDataReader
combined with a TOP N command in your SQL query.
--
To reply, remove a "l" before the @. sign.
Arnaud Weil - MCT, MCSD.Net, MCAD.Net
Suggestion please..
Our clients are already using the forms authentication where we check the
User/Pwd from SQL svr Database. We also have some SETTINGS for the user save
d
in the database(helps us to restrict the user access some things) .
We wanted to implement AD authentication for the same and also keep the
existing SQL SVr User DB.
My Q would be how to MAP the LDAP user to the SQL svr User, so we can get
the SETTINGS defined for the user in the SQL svr Database.
Any suggestion is appreciated..
Thanks
Vinay
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
--_,>/'_--
(_) \(_)
--Following URL maybe is helpful:
http://msdn.microsoft.com/library/d...
d16.asp
Elton Wang
"vinay" wrote:
> I have a scenario, need your suggestion..
> Our clients are already using the forms authentication where we check the
> User/Pwd from SQL svr Database. We also have some SETTINGS for the user sa
ved
> in the database(helps us to restrict the user access some things) .
> We wanted to implement AD authentication for the same and also keep the
> existing SQL SVr User DB.
> My Q would be how to MAP the LDAP user to the SQL svr User, so we can get
> the SETTINGS defined for the user in the SQL svr Database.
> Any suggestion is appreciated..
> Thanks
> Vinay
> --
> http://pathidotnet.blogspot.com
> =====
> vInAypAtHi
> o__
> --_,>/'_--
> (_) \(_)
> --
Elton
Thanks for the link, i have done the LDAP authentication already.
I am looking for a way to link the LDAP user to the existing SQL svr user.
Thanks
--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
--_,>/'_--
(_) \(_)
--
"Elton W" wrote:
> Following URL maybe is helpful:
> http://msdn.microsoft.com/library/d...r />
mod16.asp
> Elton Wang
>
> "vinay" wrote:
>
Suggestion please..
Our clients are already using the forms authentication where we check the
User/Pwd from SQL svr Database. We also have some SETTINGS for the user saved
in the database(helps us to restrict the user access some things) .
We wanted to implement AD authentication for the same and also keep the
existing SQL SVr User DB.
My Q would be how to MAP the LDAP user to the SQL svr User, so we can get
the SETTINGS defined for the user in the SQL svr Database.
Any suggestion is appreciated..
Thanks
Vinay
--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
--_,>/'_--
(_) \(_)
-----Following URL maybe is helpful:
http://msdn.microsoft.com/library/d...ml/secmod16.asp
Elton Wang
"vinay" wrote:
> I have a scenario, need your suggestion..
> Our clients are already using the forms authentication where we check the
> User/Pwd from SQL svr Database. We also have some SETTINGS for the user saved
> in the database(helps us to restrict the user access some things) .
> We wanted to implement AD authentication for the same and also keep the
> existing SQL SVr User DB.
> My Q would be how to MAP the LDAP user to the SQL svr User, so we can get
> the SETTINGS defined for the user in the SQL svr Database.
> Any suggestion is appreciated..
> Thanks
> Vinay
> --
> http://pathidotnet.blogspot.com
> =====
> vInAypAtHi
> o__
> --_,>/'_--
> (_) \(_)
> -----
Elton
Thanks for the link, i have done the LDAP authentication already.
I am looking for a way to link the LDAP user to the existing SQL svr user.
Thanks
--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
--_,>/'_--
(_) \(_)
-----
"Elton W" wrote:
> Following URL maybe is helpful:
> http://msdn.microsoft.com/library/d...ml/secmod16.asp
> Elton Wang
>
> "vinay" wrote:
> > I have a scenario, need your suggestion..
> > Our clients are already using the forms authentication where we check the
> > User/Pwd from SQL svr Database. We also have some SETTINGS for the user saved
> > in the database(helps us to restrict the user access some things) .
> > We wanted to implement AD authentication for the same and also keep the
> > existing SQL SVr User DB.
> > My Q would be how to MAP the LDAP user to the SQL svr User, so we can get
> > the SETTINGS defined for the user in the SQL svr Database.
> > Any suggestion is appreciated..
> > Thanks
> > Vinay
> > --
> > http://pathidotnet.blogspot.com
> > =====
> > vInAypAtHi
> > o__
> > --_,>/'_--
> > (_) \(_)
> > -----
Saturday, March 24, 2012
Suggestions to prevent VICIOUS data input?
In places where I allow data input by users (sign up forms, comments,
etc...) do I need to manually safeguard my site against vicious attacks (SQL
injection, etc...)? Should I just run all input thru a filter that removes
all special characters, like asterick, semicolon, etc...? Or, is this
handled internally so I don't have to worry about it? Any suggestions?
Thanks.VB Programmer wrote:
> Using ASP.NET 2.0/SQL Express...
> In places where I allow data input by users (sign up forms, comments,
> etc...) do I need to manually safeguard my site against vicious attacks (SQL
> injection, etc...)? Should I just run all input thru a filter that removes
> all special characters, like asterick, semicolon, etc...? Or, is this
> handled internally so I don't have to worry about it? Any suggestions?
> Thanks.
It depends... You can validate your form entries with regular
expressions (client side AND server side) and the like. Other than that,
the main thing is using parameterized queries - *NOT* string
concatenation to make your SQL queries (that's really asking for
trouble). That would be a good start :) ASP.NET also does protect you to
some extent.
john smith wrote:
> VB Programmer wrote:
> > Using ASP.NET 2.0/SQL Express...
> > In places where I allow data input by users (sign up forms, comments,
> > etc...) do I need to manually safeguard my site against vicious attacks (SQL
> > injection, etc...)? Should I just run all input thru a filter that removes
> > all special characters, like asterick, semicolon, etc...? Or, is this
> > handled internally so I don't have to worry about it? Any suggestions?
> > Thanks.
> It depends... You can validate your form entries with regular
> expressions (client side AND server side) and the like. Other than that,
> the main thing is using parameterized queries - *NOT* string
> concatenation to make your SQL queries (that's really asking for
> trouble). That would be a good start :) ASP.NET also does protect you to
> some extent.
What he said ^
Also, when using regular expressions, look for GOOD input, and reject
anything that doesn't match. Doing it the other way around, you're
bound to miss something...
Damien
Hi, as part of your research, you should investigate a product I wrote that
handles SQL Injection and Cross Site Scripting attacks. It is VAM: Visual
Input Security. (http://www.peterblum.com/vise/home.aspx)
-- Peter Blum
www.PeterBlum.com
Email: PLBlum@.PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"VB Programmer" <dont@.emailme.com> wrote in message
news:eGdttg6JGHA.916@.TK2MSFTNGP10.phx.gbl...
> Using ASP.NET 2.0/SQL Express...
> In places where I allow data input by users (sign up forms, comments,
> etc...) do I need to manually safeguard my site against vicious attacks
> (SQL injection, etc...)? Should I just run all input thru a filter that
> removes all special characters, like asterick, semicolon, etc...? Or, is
> this handled internally so I don't have to worry about it? Any
> suggestions?
> Thanks.
Suggestions to prevent VICIOUS data input?
In places where I allow data input by users (sign up forms, comments,
etc...) do I need to manually safeguard my site against vicious attacks (SQL
injection, etc...)? Should I just run all input thru a filter that removes
all special characters, like asterick, semicolon, etc...? Or, is this
handled internally so I don't have to worry about it? Any suggestions?
Thanks.VB Programmer wrote:
> Using ASP.NET 2.0/SQL Express...
> In places where I allow data input by users (sign up forms, comments,
> etc...) do I need to manually safeguard my site against vicious attacks (S
QL
> injection, etc...)? Should I just run all input thru a filter that remove
s
> all special characters, like asterick, semicolon, etc...? Or, is this
> handled internally so I don't have to worry about it? Any suggestions?
> Thanks.
>
It depends... You can validate your form entries with regular
expressions (client side AND server side) and the like. Other than that,
the main thing is using parameterized queries - *NOT* string
concatenation to make your SQL queries (that's really asking for
trouble). That would be a good start :) ASP.NET also does protect you to
some extent.
john smith wrote:
> VB Programmer wrote:
> It depends... You can validate your form entries with regular
> expressions (client side AND server side) and the like. Other than that,
> the main thing is using parameterized queries - *NOT* string
> concatenation to make your SQL queries (that's really asking for
> trouble). That would be a good start :) ASP.NET also does protect you to
> some extent.
What he said ^
Also, when using regular expressions, look for GOOD input, and reject
anything that doesn't match. Doing it the other way around, you're
bound to miss something...
Damien
Hi, as part of your research, you should investigate a product I wrote that
handles SQL Injection and Cross Site Scripting attacks. It is VAM: Visual
Input Security. (http://www.peterblum.com/vise/home.aspx)
-- Peter Blum
www.PeterBlum.com
Email: PLBlum@.PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"VB Programmer" <dont@.emailme.com> wrote in message
news:eGdttg6JGHA.916@.TK2MSFTNGP10.phx.gbl...
> Using ASP.NET 2.0/SQL Express...
> In places where I allow data input by users (sign up forms, comments,
> etc...) do I need to manually safeguard my site against vicious attacks
> (SQL injection, etc...)? Should I just run all input thru a filter that
> removes all special characters, like asterick, semicolon, etc...? Or, is
> this handled internally so I don't have to worry about it? Any
> suggestions?
> Thanks.
>
Suggestions: Filling calendar with db events
best way to fill a calendar with this data? As I switch months I want it to
repopulate with the "current" months data.
I'd like it to kind of work like a basic Outlook calendar.
Thanks!1. Create a calendar interface in ASP.Net/HTML.
2. Populate it with data.
3. What exactly do you need help with?
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>
I have a calendar on the aspx page. How can I bind it to data that comes
from a sql server db?
Ex:
Event 1 - 12/1/2004
Event 2 - 12/3/2004
Event 3 - 12/5/2004
So, if you were to go on the calendar to Dec 2004 Event 1 would show up in
the 12/1 box, Event 2 in the 12/3 box, etc... If I switched the calendar to
January it would populate the calendar with January events.
Thanks Kevin.
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ukQqNsT3EHA.2624@.TK2MSFTNGP11.phx.gbl...
> 1. Create a calendar interface in ASP.Net/HTML.
> 2. Populate it with data.
> 3. What exactly do you need help with?
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
> "VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
> news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> to
>
check out these code samples:
http://aspnet101.com/aspnet101/aspn...?code=caltitles
http://aspnet101.com/aspnet101/aspn...spx?code=CalMdb
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>
(Sorry - the other link was supposed to be:
http://aspnet101.com/aspnet101/aspn...x?code=calendar)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
>
Suggestions: Filling calendar with db events
best way to fill a calendar with this data? As I switch months I want it to
repopulate with the "current" months data.
I'd like it to kind of work like a basic Outlook calendar.
Thanks!1. Create a calendar interface in ASP.Net/HTML.
2. Populate it with data.
3. What exactly do you need help with?
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
I have a calendar on the aspx page. How can I bind it to data that comes
from a sql server db?
Ex:
Event 1 - 12/1/2004
Event 2 - 12/3/2004
Event 3 - 12/5/2004
So, if you were to go on the calendar to Dec 2004 Event 1 would show up in
the 12/1 box, Event 2 in the 12/3 box, etc... If I switched the calendar to
January it would populate the calendar with January events.
Thanks Kevin.
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:ukQqNsT3EHA.2624@.TK2MSFTNGP11.phx.gbl...
> 1. Create a calendar interface in ASP.Net/HTML.
> 2. Populate it with data.
> 3. What exactly do you need help with?
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
> "VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
> news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
>> I have a bunch of events and appointments in a sql server db. What is
>> the
>> best way to fill a calendar with this data? As I switch months I want it
> to
>> repopulate with the "current" months data.
>>
>> I'd like it to kind of work like a basic Outlook calendar.
>>
>> Thanks!
>>
>>
check out these code samples:
http://aspnet101.com/aspnet101/aspn...?code=caltitles
http://aspnet101.com/aspnet101/aspn...spx?code=CalMdb
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
(Sorry - the other link was supposed to be:
http://aspnet101.com/aspnet101/aspn...x?code=calendar)
David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
Coming Soon - Data Management Toolkit
Manage MSDE/SQL Server/MySQL/MS Access Databases from one location.
http://augustwind.com/augustwind/dmt.aspx
"VB Programmer" <Dont*NoSpam-Please*@.jEmail.com> wrote in message
news:eC0CzfT3EHA.1264@.TK2MSFTNGP12.phx.gbl...
> I have a bunch of events and appointments in a sql server db. What is the
> best way to fill a calendar with this data? As I switch months I want it
to
> repopulate with the "current" months data.
> I'd like it to kind of work like a basic Outlook calendar.
> Thanks!
Summary of data in ASP.NET
i am pretty new to asp.net and would like advice on how to best summarise data from an sql server database.
i have some data in a table, each record containing someones name and a 'type' field (contains positive or negative) among other stuff . i need to summarise the count of how many times a persons name appears in the table and display how many positive/negative entries there are.
i've used VB6 and VBA for ages and know how to do this by stepping through recordsets etc but want to know what the best approach is in ADO.NET, i'm still trying to get my head round data readers, datassets, data adapters, data tables etc.
any help is greatly appreciated
thanks
mickThis aggregation would probably be best left to your SQL engine of choice.
Based on the table:
PersonName varchar(50)
Active bit
With the values
PersonName Active
Tom 0
Tom 0
Tom 1
Jane 1
Jim 0
The query:
SELECT PersonName, COUNT(PersonName) HitCount, Active
FROM Person
GROUP BY PersonName, Active
ORDER BY PersonName
Should result in:
PersonName HitCount Active
Jane 1 1
Jim 1 0
Tom 2 0
Tom 1 1
From here, any tutorial on querying a database via SQL (a data reader should be fine) should apply.
thanks very much.
Thursday, March 22, 2012
Support for SQL views
Are views (?) not supported?
Seems hard to imagine they're not ... but I don't see themWhere? In what tool? What is the database involved?
SQL Views are accessible from asp.net just like a table.