Going Nuts Trying To Do This

Jan 12, 2004

Im going completly nuts trying to do this. In ASP it would have taken me seconds.





Ok I think this is right but correct me if im wrong





I have a class that for example has a function that gets all the states from the DB:





File called Class.vb





Imports System


Imports System.Data


Imports System.Data.SqlClient


Imports System.Collections


Imports System.Configuration








Public Class Getalldata


Public Function GetPicdata() As SqlDataReader





Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("CONNECTION_STRING_USER"))


Dim cmd As New SqlCommand("Get_states", cnn)








cnn.Open()


Dim result As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)


cnn.Close()





End Function


End Class





Ok How in the hell do I call this just to LOOP and print them out????








Sort of like this





Call class/object/whatever. I dont know how





Then





While Whaever





Loops thru the states response.writting them





Loop





Please hel;p before I completly go nuts

View 1 Replies


ADVERTISEMENT

Going Nuts Here!

Aug 30, 2004

Alright- I plugged this code in to tell my form to write to SQLServer when I click the Submit button. However I error out when I load the form:


dim Conn as new OleDbConnection("DSN=MyDB")

Sub On_Click(obj as object, e as EventArgs)
dim params(3) as String
dim strSQL as String

strSQL="INSERT INTO tblSCRequest "(strRequestor, dtRequestDate, strAudience) VALUES (" & _
"'" & params(0) & "'," & _
"'" & params(1) & "'," & _
"'" & params(2) & "'")

ExecuteStatement(strSQL)
end sub

function ExecuteStatement(strSQL)
dim objCmd as new OleDbCommand(strSQL, Conn)

try
objCmd.Connection.Open()
objCmd.ExecuteNonquery()
catch ex as Exception
end try
objCmd.Connection.Close()
end function

I get this error:
C:InetpubwwwrootSOSCommCommWeb4.aspx(14) : error BC30471: Expression is not an array or a method, and cannot have an argument list.

strSQL="INSERT INTO tblSCRequest "(strRequestor, dtRequestDate, strAudience) VALUES (" & _
~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:InetpubwwwrootSOSCommCommWeb4.aspx(14) : error BC30205: End of statement expected.

strSQL="INSERT INTO tblSCRequest "(strRequestor, dtRequestDate, strAudience) VALUES (" & _
~~~~~~~~~~~~~
C:InetpubwwwrootSOSCommCommWeb4.aspx(15) : error BC30035: Syntax error.

"'" & params(0) & "'," & _


Any ideas??

View 5 Replies View Related

Need Help With Aspnetdb.mdf As Im Going Nuts

Aug 1, 2006

I been all over this forum trying to find out how to get the aspnetdb.mdf running on my remote site and its driving me nuts.
i been using VWD 2005 express Edition and SQL Express 
Error Server Error in '/' Application.
An attempt to attach an auto-named database for file I:DataWebqsh.eumarker_93618920-db3b-4a04-a274-3fb613afc5dfwwwApp_Dataaspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
over the last week it has been a nightmare trying to get anything working on the site but i have got all the other databases working but i can get the aspnetdb.mdf working. i am very new to ASP.net so please use the he kiss method  "Keep It Simple, Stupid!" as im a newbe to this and it will just go over my head.
Thanks 

View 3 Replies View Related

Simple Login, I'm Going Nuts (new Guy, Please Help)

Apr 17, 2006

Hi all, quick, hopefully simple question that has been driving me nuts for 3 days.  Using Visual Studio 2005, doing a web app, connecting to an SQL server with already existing login names and passwords...
I have a login name and password text box and a login button.  Upon clicking, sqldatasource1 checks to see if the items in the text box match a login and password in the DB.  If so, it sets Profile.login and Profile.password to the values in that text box so I can use it to key off the DB for application IDs associated with that login/pass later.
It displays just the login name in a details view upon a match.  If nothing is there that matches, it shows a hidden label saying "login failed".
My problem is, that I really don't want the detailsview to display if there is a match.  I want it to automatically go to page2.aspx...but I can't figure this out.  Response.Redirect("page2.aspx"); doesn't work.  It's like the check is happening before detailsview1 shows any data and therefore it doesn't load page2....and I can't figure out how to get it to check detailsview1 for data AFTER it has been displayed.
I guess that I don't know how to get this thing to check if there is something in the detailsview, to go to page 2.  It's just not working.  Any help would be great!  (BTW, not using the builtin login control because I can't figure out how to get that to connect to our sql database's login table.)
Thanks all!

View 7 Replies View Related

Sp_processmail - Driving Me Nuts!

Apr 2, 2004

I have two different SQL server installations (7 and 2000) that I have configured for using the SP_processmail procedure. Both servers can properly execute xp_startmail, xp_stopmail, xp_readmail, and xp_findnextmsg. HOWEVER, both have different problems with SP_processmail.

Using this command (and a host of many other variations):
sp_processmail @filetype = 'CSV', @separator = ',', @dbuse = 'ryantest', @set_user = 'guest'

SQL 7.0 says: Server: Msg 18007, Level 16, State 1, Line 0
Supplied datatype for @set_user is not allowed, expecting 'varchar'

I have tried every variation possible, including not specifying the yser which should result in it defaulting to the "guest" account. The message is always the same.

SQL 2000 says: Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005
Queries processed: 0.

I have checked all my configurations and read every KB article - I can't find anything wrong.

Can someone PLEASE respond if you have any experience with SP_PROCESSMAIL on your servers.

Thanks in advance.

Ryan Hunt

View 1 Replies View Related

Math Is Driving Me Nuts

Jul 20, 2005

The business rule is, the sales manager is commissioned on the avg. numberof appointments set up per salesrep per day during the month.I have 2 tables: The UserLog table records only 1 entry per day per user(salesrep). This will log how many salesreps worked a particular day. Thesecond table logs any appointments set up.UserLog: ID, UserName, EnteredTimeAppointment: ApptID, EnteredTime, ApptDateI figured that, for a given date ranged, I could1. sum the number of appointments2. sum the number of days worked2. sum the salesreps / number of days = avg number of salesreps per day3. number of appointments / avg number of salesreps per day = avg numberof appointments per sales repBut this logic is flawed. If I average out every day and then take anaverage of this daily average, I get a different result. Any ideas on howto best solve this problem?Thanks.

View 7 Replies View Related

Going Nuts - The ConnectionString Property Has Not Been Initialized - Help!

May 27, 2006

I'm struggling with the different methodologies for using DataSets in 2.0. I can knock this out in no time flat in 1.0, but am bogged down in 2.0. Can anyone guide me on the right track? My code is below. I'm forming a DataSet from a SQL Server Express database from the user's choice from a drop down. My connection string "ASOCTCOConnectionString" is declared in my web.config and used successfully throughout in the WYSIWYG configurations of my databound controls.  But I want to control this in code. This si getting frustrating and right now I'm longing for the clean simplicity I had with Web Matrix :(
In any case, any suggestions? It crashes with this error when opening the connection with MyConn.Open(). I just want to be able to configure a DataSet and apply it to my controls and results.
<code>
Dim connectionString As String = System.Configuration.ConfigurationManager.AppSettings("ASOCTCOConnectionString")
Dim MyConn As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim MyQuery, SearchString As String

Dim myAdapter As New System.Data.SqlClient.SqlDataAdapter
Dim myDataSet As New System.Data.DataSet
Dim mySelectCommand As New System.Data.SqlClient.SqlCommand
mySelectCommand.CommandText = "SELECT * from Device_Type where Category LIKE " & DDLDevType.SelectedItem.Text
mySelectCommand.Connection = MyConn
MyConn.Open()
Grid1.DataSource = myDataSet
Grid1.Databind()
MyConn.Close()
</code>

View 11 Replies View Related

This Is Driving Me Nuts - Solicit Help From The Gurus

Jul 20, 2005

Hi -I hope some one can help me with this.I am using sql server 2000[Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 200316:08:15 Copyright (c) 1988-2003 Microsoft Corporation EnterpriseEdition on Windows NT 5.0 (Build 2195: Service Pack 4)]I have a stored procedure that is using cursors and a few joins, andwrites to a few tables. (I can post the code if that will help) Thestored procedure takes approximately 27 seconds to complete whenexecuted inside query analyser. However, if I run the stored proceduresource directly inside query analyser (like a long sql script), ittakes only 3 seconds!! These results are consistent and reproducible.I would think a stored procedure stores the plan, and I would expectbetter optimization. Why am I witnessing the opposite behaviour? Anyone has any experience?The server is manned by DBAs (I work at a large corporation), so Ibelieve it is well configured. We have noticed similar behaviour ondata restores on a different physical server.Thanks in advance,-praty77

View 6 Replies View Related

Simple IIF Statement Driving Me Nuts

Oct 17, 2007



I have an IIF statement in a text box. Its very basic

What I want is to check if the value of something is greater than 1. If it is, then make it 1. If it isn't then just use what the value is.

(loose example)

=IIF((Field!Var1.Value * Field!Var2.Value)>1, 1,Nothing)

Basically I can't have a pecentage greater than 100. If it is then make it 100. If its not then just use the result of the calculation.

View 7 Replies View Related

Driving Me Nuts: Error: 18456, Severity: 14, State: 16.

Oct 16, 2007

Hello,

I'm currently evaluating Visual Studio Team System using SQL Server 2005 (9.00.3042.00, SP2, Enterprise Evaluation Edition) and from time to time, I get this error:


Error: 18456, Severity: 14, State: 16.

If I try to connect to the database using SQL Server Management Studio, I get the error:

"A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP provider, error: 0 - An existing connection was forcibly closed by the remote host.) (Microsoft SQL Server, Error: 10054)".

If I restart the SQL Server services, everything works fine! This is driving me nuts!

Additional information:
- The user accounts and security are OK - they have been double checked, and once the services are restarted everything works fine.
- SQL Server is configured to accept remote connections - again, once the services are restarted eveything works fine.
- I have disabled meanwhile the following protocols: VIA, Named Pipes, Shared Memory both at the Server and Client - and the problem still remains.

Any help?

Thanks!
João

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved