|
I like to keep my tables a little less broad. Perhaps some normalization is in order?
Other than possibly using a DataAdapter you're stuck with creating the parameters. What would a for loop gain you?
only two letters away from being an asset
|
|
|
|
|
castrand1 wrote: I have a question about the best way to Insert/Update a table that has around 117 fields.
Well, there's two things here.
1 - the number of fields does not change the code
2 - your database design is dreadful to non existant.
castrand1 wrote: Both of those need Parameters setup, but that's a lot of fields to setup.
Yes, sometimes a programmer needs to actually write code. Terrible, it's true. Your core issue is your broken table design, however.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
castrand1 wrote: a table that has around 117 fields.
After putting in about 30 fields, did it occur to you that this may not be the best design??
|
|
|
|
|
Hello All,
I appreciate all the comments and yes, that database is bad and needs to be redesigned.
Let me explain what the table holds and maybe I could get some insight in how to best redesign it.
The table stores information about ships. These ships are of a tanker type ship, ones that hold crude oil, vegetable oil, etc.
Of all the fields in the table, most of the fields describe the ship, such as, dimensions, draughts, capacities, deadweights, etc. So, every ship will have unique values in the fields.
There are several fields that are relational. Hull Types, Owners, Classifications, Status, etc, other than that, all the other fields would hold unique values.
Thank you for your help,
Chuck
|
|
|
|
|
You can start by putting fields related to a subject about the ship in their own tables. Such as a ships navigation equipment goes in one table, hull information in another, engine information in another, ... You're not going to need every pipece of information about a ship all at once, so it's better break the data down into smaller logical blocks of related information and keep each block in its own table.
|
|
|
|
|
Dave,
Thank you for your suggestions with this issue. It made a lot of sense and I don't know why I did not see it. I have not really run into an issue of this type. So, I split the table into 6 different tables, each with less than 20 fields each, much more manageable.
Again, thank you.
Chuck
|
|
|
|
|
Hey,
I have a couple of link buttons and I am trying to get them to open a page in a new window. I know how to do this with a normal link, but I also have some very simple code behind that I need to run (Set a session variable).
I've tried to add attributes to the linkbutton by doing lnkBtnEnterprise.Attributes.Add("Target", "_blank");
but that doesnt seem to do anything. Let me know if you have any suggestions. Thanks for your time.
protected void lnkBtnEnterprise_Click(object sender, EventArgs e)
{
lnkBtnEnterprise.Attributes.Add("Target", "_blank");
Session["Owner"] = 1;
Response.Redirect("~/SampleDashboardDetails.aspx");
}
JM
|
|
|
|
|
I also tried putting lnkBtnEnterprise.Attributes.Add("Target", "_blank"); on the page load event.
|
|
|
|
|
First, this won't do anything for you. You are applying an attribute to the link then immediately redirecting to another page.
Second, attributes are case sensitive, target should be lowercase.
only two letters away from being an asset
|
|
|
|
|
I have absolutely no clue, is this ASP.NET?
|
|
|
|
|
Yes, it is ASP.NET. I was trying to open the page using C# and w/o javascript. I've spent all day trying to figure it out to no avail.
When I do the lnkBtnEnterprise.Attributes.Add("target", "_blank"); and click the button on the page, I get an error of "Microsoft JScript runtime error: Object expected"
|
|
|
|
|
WE have an ASP.NET forum. Posting in the C# forum leaves people trying to figure out if you're writing a web app, which is often less obvious than it was in this case.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
OK, but its a C#.Net question, is it not? Thats why I thought this forum was more appropriate.
|
|
|
|
|
The code might be in C# but the concepts are either Web Development or ASP.Net, either of which would, in my opinion, be better homes for your question.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
OK, I'll post the question over there. Thanks anyway for your help.
|
|
|
|
|
I found a solution. I ended up changing the link buttons to links and passed a variable through the link, then grabbed the variable and stored it to the session variable I was using in a Page_PreInit function.
Send it from first page:
<asp:HyperLink ID="lnkEnterprise" runat="server" NavigateUrl="~/SampleDashboardDetails.aspx?Owner=1" Target="_blank">Enterprise Details</asp:HyperLink>
Receive on second page:
protected void Page_PreInit(Object sender, EventArgs e)
{
Session["Owner"] = Request.QueryString["Owner"];
}
Thanks for your help guys.
|
|
|
|
|
<asp:LinkButton ID="lbtnValidRules" runat="server" Text="Validation Rules" OnClientClick="window.open('ValidationRules.aspx', 'ValidRules', 'width=1100,height=800,status=yes'); return false;">
</asp:LinkButton>
this is how I do
|
|
|
|
|
Seriously, WTF. Session, Response??? This doesn't give you a clue??
only two letters away from being an asset
|
|
|
|
|
Barely, sounds like webcrap, I'm not into that at all
|
|
|
|
|
btw did you onevote me for not having a clue?
|
|
|
|
|
No, I did not. I'm not even sure what onevote is.
|
|
|
|
|
I am writing an XML web service in VS2008 using C#. SQL and VS are running on the same box. There are several SQL instances running because we are using the box to support our customers who are mixed 2005/2008 SQL server. From inside VS I can create a data connection to one of our SQL instances. The box is ESSERV and the instance is ES2008 so the connection string that is in the connection object is:
"Data Source=ESSERV\ES2008;Initial Catalog=ESData08;Integrated Security=True"
This works fine. I can see the ESData08 database, tables, SPs, etc. No problems. So in C# I use the following code:
String sqlConn = "Data Source=ESSERV/ES2008;Initial Catalog=ESData08;Integrated Security=True";
SqlConnection esConn = new SqlConnection(sqlConn);
esConn.Open();
YES, I flipped the backslash between ESSERV and ES2008 to a forward slash. MSDN said that was OK to do so it doesn't look like an escape sequence. And here is part of what I get:
System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection........... and about 2 dozen more lines of error.
So my question is WHY? I have tried every combination of ESSERV\ES2008 and all of them give me the same error. Named Pipes are enabled. So what is causing this error and is there a way to specify the data connection I have already defined and know works. I'm kind of new to VS and C# but I'm sure that the code is correct as it compiles and runs up to the open. Any help with this nightmare would be appreciated.
Thanks,
Joe B
|
|
|
|
|
In case you aren't aware of it there is an excellent site connectionstrings.com[^], that can be very useful in situations like this.
It offers connection strings for most scenarios.
This[^] thread talks about the same error you have, and the first answer says it has the solution. I haven't followed the link, as I don't use named pipes and therefore cannot tell if that is correct.
Anyway, good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry,
Thanks for the response but NO. Not one of the connection strings worked. This is unbelievably frustrating. I am now 12 hours into beating my head against this issue. SOMEONE must know what is in the way. EVERY single think I tried returns this:
System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
MICROSOFT..... ARE YOU LISTENING??????? 12 hours for a connection string. I am NOT a db admin, nor a network admin. I write code and this is NOT GOOD. It can't be this hard to connect to a SQL Server that's on the same machine as the Web Service.
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
delete
modified 2-Apr-21 5:21am.
|
|
|
|
|