Click here to Skip to main content
16,005,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
trooper081414-May-07 10:38
trooper081414-May-07 10:38 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Ibuprofen14-May-07 10:41
Ibuprofen14-May-07 10:41 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Colin Angus Mackay14-May-07 11:35
Colin Angus Mackay14-May-07 11:35 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Christian Graus14-May-07 13:24
protectorChristian Graus14-May-07 13:24 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Ibuprofen15-May-07 2:50
Ibuprofen15-May-07 2:50 
AnswerRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Christian Graus14-May-07 13:26
protectorChristian Graus14-May-07 13:26 
AnswerRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Guffa14-May-07 20:49
Guffa14-May-07 20:49 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Ibuprofen15-May-07 2:48
Ibuprofen15-May-07 2:48 
1. People have said this, but I still don't understand what they mean.

2. Why should you never have DB code in your presentation layer?

3. Actually, that is my most recent problem, the exception is catching an error, every value is updating the table, yet the exception err, is throwing "cannot find table 0"

4. I didn't even know you could do that, you would think the people that I work with that have degree's would code the write way, I guess not!

5. Eh, button1, I normaly do, this page actually only has one button it. I just hadn't gotten to renameing it.

Here is the most recent of my button1click,

private void Button1_Click(object sender, System.EventArgs e)<br />
		{<br />
			bool bNoError =true;<br />
			OleDbConnection con = new OleDbConnection(strConnection2);<br />
			string strSQL="";<br />
			DataSet ds = new DataSet();<br />
			CUsers user =new CUsers();<br />
			user=(CUsers)Session["SessionUser"];<br />
			switch(user.Role)<br />
			{<br />
					case "TL":<br />
					//string strStatus="";<br />
						if(TicketStatus.SelectedValue=="Closed")<br />
						{<br />
							string strStatus="Closed";<br />
							TicketClosedBy.Text = strStatus;						<br />
<br />
						}<br />
						else<br />
						{<br />
							TicketClosedBy.Text="";<br />
						}<br />
<br />
<br />
					strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text;<br />
					<br />
					break;<br />
				case "CP":<br />
					if(TicketStatus.SelectedValue=="Closed")<br />
					{<br />
						string strStatus="Closed";<br />
						TicketClosedBy.Text = strStatus;						<br />
<br />
					}<br />
					strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"',  [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
					break;<br />
<br />
				case "ORA":<br />
					if(TicketStatus.SelectedValue=="Closed")<br />
					{<br />
						string strStatus="Closed";<br />
						TicketClosedBy.Text = strStatus;						<br />
<br />
					}<br />
					strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"',  [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
					break;<br />
<br />
				case "DMO":<br />
					if(TicketStatus.SelectedValue=="Closed")<br />
					{<br />
						string strStatus="Closed";<br />
						TicketClosedBy.Text = strStatus;						<br />
<br />
					}<br />
					strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.Text+"',  [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
					break;<br />
<br />
				case "User":<br />
					if(TicketStatus.SelectedValue=="Closed")<br />
					{<br />
						string strStatus="Closed";<br />
						TicketClosedBy.Text = strStatus;						<br />
<br />
					}<br />
					strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text;<br />
					break;<br />
			}	<br />
						<br />
			try<br />
			{<br />
				OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2);				<br />
				<br />
				da.Fill(ds);<br />
				DataTable mytable   =ds.Tables[0];<br />
				DataRow myRow ; <br />
				myRow = mytable.Rows[0];<br />
<br />
				string n ;<br />
				foreach(DataColumn c in mytable.Columns)<br />
				{<br />
					n = c.ColumnName;<br />
					if(n=="autoNum")<br />
					{<br />
						continue;<br />
					}<br />
					myRow[n] =ControlTypeCheck.CheckControlType(Page.FindControl(n),n);<br />
					//					}<br />
				}<br />
				OleDbCommandBuilder cb = new OleDbCommandBuilder(da);<br />
				da.Update(ds);<br />
				<br />
			}<br />
			catch(Exception err)<br />
			{<br />
				string str=err.Message;<br />
				bNoError=false;<br />
			}<br />
			finally<br />
			{<br />
				con.Close();<br />
			}<br />
			<br />
			//return bNoError;<br />
		}<br />
		}


Error is - Cannot find table 0.
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Ibuprofen15-May-07 3:09
Ibuprofen15-May-07 3:09 
GeneralRe: Use of unassigned local variable trying to pass a sql statment through a var. Pin
Ibuprofen15-May-07 3:21
Ibuprofen15-May-07 3:21 
QuestionOpening the hyperlink in a pop up window from grid view Pin
just3ala214-May-07 9:00
just3ala214-May-07 9:00 
AnswerRe: Opening the hyperlink in a pop up window from grid view Pin
kubben14-May-07 9:06
kubben14-May-07 9:06 
GeneralRe: Opening the hyperlink in a pop up window from grid view Pin
just3ala214-May-07 21:51
just3ala214-May-07 21:51 
QuestionDEBUG help, System.NullReferenceException Pin
Ibuprofen14-May-07 8:18
Ibuprofen14-May-07 8:18 
AnswerRe: DEBUG help, System.NullReferenceException Pin
Tarakeshwar Reddy14-May-07 8:39
professionalTarakeshwar Reddy14-May-07 8:39 
GeneralRe: DEBUG help, System.NullReferenceException Pin
Ibuprofen14-May-07 8:54
Ibuprofen14-May-07 8:54 
GeneralRe: DEBUG help, System.NullReferenceException Pin
Ibuprofen14-May-07 9:03
Ibuprofen14-May-07 9:03 
QuestionAdvance Screen Scrapping..! Pin
wEb GuRu...14-May-07 7:46
wEb GuRu...14-May-07 7:46 
AnswerRe: Advance Screen Scrapping..! Pin
PSK_14-May-07 17:57
PSK_14-May-07 17:57 
QuestionASP.Net 2.0 Menu Control Pin
Rhys Gravell14-May-07 7:20
professionalRhys Gravell14-May-07 7:20 
AnswerRe: ASP.Net 2.0 Menu Control Pin
martin_hughes14-May-07 11:59
martin_hughes14-May-07 11:59 
QuestionRewriteUrl results in blank page? Pin
eggsovereasy14-May-07 6:33
eggsovereasy14-May-07 6:33 
QuestionText box to from address in contact form Pin
archangel71714-May-07 4:15
archangel71714-May-07 4:15 
AnswerRe: Text box to from address in contact form Pin
Not Active14-May-07 5:10
mentorNot Active14-May-07 5:10 
GeneralRe: Text box to from address in contact form Pin
archangel71714-May-07 9:40
archangel71714-May-07 9:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.