
bripoin
Members-
Posts
25 -
Joined
-
Last visited
bripoin's Achievements
Newbie (1/14)
0
Reputation
-
More help needed with accessing data from a database
bripoin replied to bripoin's topic in Database / XML / Reporting
Alright, I'm trying something different now. I'm using a Master and a Detail grid to show this information in two different datagrids. I'm using the same parameter of "@PermitNum" to select the information for the Master grid, but I don't know if it's acctually using this parameter. Mainly because the application "times out" before it can ever load anything. Here's the code: 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT tblPRUMaster.PruID, tblPRUMaster.PruNumber, tblPRUMaster.PruName, tblPRUMa" & _ "ster.NorthOrSouth, tblPRUMaster.PermitNo FROM tblPRUMaster INNER JOIN tblPRUProd" & _ "uction ON tblPRUMaster.PruID = tblPRUProduction.PruID WHERE (tblPRUMaster.PermitNo = @PermitNum)" Me.SqlSelectCommand1.Connection = Me.SqlConnection1 The code for the Button click: Try Me.SqlSelectCommand1.Parameters.Add("@PermitNum", SqlDbType.VarChar) Me.SqlSelectCommand1.Parameters("@PermitNum").Value = TextBox1.Text Me.LoadDataSet() Me.masterDataGrid.SelectedIndex = -1 Me.masterDataGrid().DataBind() Catch eLoad As System.Exception Me.Response.Write(eLoad.Message) End Try -
More help needed with accessing data from a database
bripoin replied to bripoin's topic in Database / XML / Reporting
When I try that I get "Overload resolution failed becasue no accessible "Int" accepts this number of arguments." The valule of the DataKeyField is a String that is pulled from the database with the first SQL Select command. -
More help needed with accessing data from a database
bripoin replied to bripoin's topic in Database / XML / Reporting
I tried Text and got: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. I tried VarChar and got: Syntax error converting the varchar value 'PruID' to a column of data type int. I tried Int and got: Input string was not in a correct format. Those last two results lead me to believe that it's grabbing the column heading with in the DataGrid instead of the information that was pulled from the database. -
Okay...I've modified my original code so that I now have two datagrids. One is for the information that I am pulling from the database that is constant for every instance of information. The other is for information that varies from instance to instance. I've gotten the first database to where it is pulling the correct information and I wrote the code so that it filters the info for the second datagrid by using the "PruID" pulled into the first datagrid. However, when I run the code, I get a blank datagrid for the second one. Here is the code for the click event: Try Me.SqlSelectCommand1.Parameters.Add("@PermitNum", SqlDbType.VarChar) Me.SqlSelectCommand1.Parameters("@PermitNum").Value = TextBox1.Text Me.LoadDataSet31() Me.DataGrid1.SelectedIndex = -1 Me.DataGrid1.DataBind() Me.SqlSelectCommand2.Parameters.Add("@PruID", SqlDbType.Variant) Me.SqlSelectCommand2.Parameters("@PruID").Value = Me.DataGrid1.DataKeyField Me.LoadDataSet51() Me.DataGrid2.SelectedIndex = -1 Me.DataGrid2.DataBind() Catch eLoad As System.Exception Me.Response.Write(eLoad.Message) End Try Any ideas as to why this is happening?
-
Okay...I've tried modifying what I had so that the information shows up in two datagrids, one for the values that are constant for all reports, and one for the values that change. When I try running what I've got now I get the following error: "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
-
Tried that. I still get repeated data.
-
I'm now working on a way to only show the data that is repeated (i.e. Permit Number, PRU ID, Location, ect.) in the datagrid for the project that I was having trouble with a couple of weeks ago. I've got the code working so that the information is pulled based on the permit number that is entered by the user, but a few fields carry the same information all the time. Is there a way to only show that information once and not repeat it for every line of data that is displayed in the output?
-
Nevermind. I changed teh Datatype to NVarChar, dropped the Integer.Parse in the value and moved the two lines that define the parameter into the click command and that worked. Thanks for all your help. I really appreciate it and I'm sorry to be such a pest.
-
Okay. I put a breeak point in the very first line of code and stepped through the application. It didn't even make it past the first line.
-
When I hit F5 to start the application it comes up with that error before the page loads to enter any information.
-
It doesn't get that far so I would assume the Value is null.
-
Could it be because I'm using a text box?
-
When it gets to the last line of the code you posted above, it gives me this: Server Error in '/ProductionApplication' Application. -------------------------------------------------------------------------------- Input string was not in a correct format. 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.FormatException: Input string was not in a correct format. Source Error: Line 30: Line 31: Me.SqlSelectCommand1.Parameters.Add("@PermitNum", SqlDbType.Int) Line 32: Me.SqlSelectCommand1.Parameters("@PermitNum").Value = Integer.Parse(TextBox1.Text) Line 33: ' Line 34: 'SqlConnection1 Source File: c:\inetpub\wwwroot\ProductionApplication\WebForm1.aspx.vb Line: 32 Stack Trace: [FormatException: Input string was not in a correct format.] System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +0 System.Int32.Parse(String s) +38 ProductionApplication.WebForm1.InitializeComponent() in c:\inetpub\wwwroot\ProductionApplication\WebForm1.aspx.vb:32 ProductionApplication.WebForm1.Page_Init(Object sender, EventArgs e) in c:\inetpub\wwwroot\ProductionApplication\WebForm1.aspx.vb:63 System.Web.UI.Control.OnInit(EventArgs e) System.Web.UI.Control.InitRecursive(Control namingContainer) System.Web.UI.Page.ProcessRequestMain() -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
-
Do you mean what am I typing in? If that's the case I'm using 32534, a Permit Number that I know is in the database.
-
Now it says "Input string was not in a correct format."