|
I have tried that and it seems its leading me to more errors
|
|
|
|
|
There's a secret error somewhere in your secret code. You should fix that.
Seriously, how do you expect anyone to be able to help you based on the complete lack of information you've provided?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
So sorry for that
here is the thang: I cant take a pic of it
Server Error in '/' Application
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral. publicKey=31bf3856ad364e35" could not be located.
... to add to that.. the web.config and packages.config are ticked red
|
|
|
|
|
You either haven't installed the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package, or the version you have installed doesn't match the version specified in your web.config file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard i have tried to install and now i am getting a different error gain.
Thanks for your help..this is the new error
Server Error in'/' Application
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error and modify your source file appropriately.
Parse Error Message: Could not load type 'NPA.MvcApplication'
|
|
|
|
|
You have an error in your Global.asax file - it doesn't match the Global.asax.cs class definition.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you for your responses. HOW DO I GO ABOUT CORRECTING THE ERROR
|
|
|
|
|
Fix your code so that the class name matches.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you so much man...
now there is another error displaying after installing
Server Error in'/' Application
Parse Error Message: vould not load type 'NPA.MvcApplication'
|
|
|
|
|
In my opinion there's a strange error in the message you're receiving. It shouldn't say that because what is describing has nothing to do with running your code.
|
|
|
|
|
Dear folks.
I am writing a program for connecting sql server database, and populating data from table using a stored procedure. it is working fine when I use the app.config file's data source as the server name, but when I use the server's ip address and port, it is not working.
it is showing error, stored procedure not found.
My app config's connection string is as below.
<connectionStrings>
<clear />
<add name="CONNECTION_FLOR"
providerName="Microsoft.Data.SqlClient"
connectionString="Data Source=172.142.1.100,1433;User ID=redacted;Password=redacted;Initial Catalog=tempdb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" />
</connectionStrings>
But when I use Data Source by name as Data Source=(localdb)\SubdivprojV13; it is working all good. The problem is with ip address and port. I checked the connection, connection is opening. But showing error as stored procedure not found.
please check my code snippet.
Public Class Form1
Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNECTION_FLOR").ConnectionString)
Private Sub BTN_DISPLAY_Click(sender As Object, e As EventArgs) Handles BTN_DISPLAY.Click
Dim cmd As New SqlCommand With {
.Connection = connection,
.CommandType = CommandType.StoredProcedure,
.CommandText = "SP_DISPLAY"
}
cmd.Connection.Open()
lbl_CONN.Text = "Connected"
lbl_CONN.ForeColor = Color.Green
Dim dt As DataTable = New DataTable()
dt.Load(cmd.ExecuteReader)
DataGridView1.DataSource = dt
DataGridView1.Update()
If connection.State = ConnectionState.Open Then
connection.Close()
lbl_CONN.Text = "DisConnected"
lbl_CONN.ForeColor = Color.Red
End If
End Sub
End Class
Any help is highly appreciated. Thanks in advance,.
modified 12-Apr-21 12:09pm.
|
|
|
|
|
You are connecting to two different databases. One is a full SQL Server database; the other is a "LocalDB" database.
SQL Server Express LocalDB - SQL Server | Microsoft Docs[^]
LocalDB databases cannot be accessed across the network.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for posting the username and password in your connection string.
You might want to change that account name and password now and don't ever use that account name ever again.
|
|
|
|
|
It's not even a private IP address!
Looks like the OP is using Verizon as their ISP. I wonder whether they've managed to open port 1433 up to the internet? :evilgrin:
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm really sorry not being able to give you a good solution for this problem you are describing. However, I recommend you going to the tech forum on Craiglist. You could find an answer over there.
|
|
|
|
|
using (SQLiteCommand cmd = conn.CreateCommand())
{
try
{
cmd.CommandText = @"SELECT * FROM. customer WHERE lastname = @setName";
cmd.Parameters.AddWithValue("@setName", txt_name.Text);
da_Customer = new SQLiteDataAdapter(cmd.CommandText, conn);
dt_Customer = new DataTable();
da_Customer.Fill(dt_Customer);
dgv_customer.DataSource = dt_Customer;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I get insufficient parameters supplied with this block of code, any ideas why?
|
|
|
|
|
At what line? It says so in the exception, so why can't you?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
First, clean up your code indentation. It makes debugging your code easier and reduces the number of bugs in your code.
Next, in your SQL statement, get rid of the period you have on the FROM clause. Then get rid of the * and replace it with the fields you want. Trust me, using "SELECT *" is NOT a habit you want to get into.
SELECT fieldList, ... FROM customer WHERE lastname=@setName";
After that, why are you creating a SqlCommand object only to throw it out and never use it with the DataAdapter? The SqlDataAdapter will take a SqlCommand object as a parameter, but you just pass in the SQL statement (.Text property) of the command you built, effectively ignoring the parameter object you built.
Your code should be this:
using (SQLiteCommand cmd = conn.CreateCommand())
{
try
{
cmd.CommandText = @"SELECT * FROM customer WHERE lastname = @setName";
cmd.Parameters.AddWithValue("@setName", txt_name.Text);
da_Customer = new SQLiteDataAdapter(cmd);
dt_Customer = new DataTable();
da_Customer.Fill(dt_Customer);
dgv_customer.DataSource = dt_Customer;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} Also, it seems you're using class global data objects, "da_Customer", "dt_Customer", ... This is a REALLY BAD IDEA and will get you into trouble in the future with bugs that are really difficult to find.
You should have individual methods that will return data, creating and disposing their own database objects, more like this:
public DataTable GetCustomerTableFromLastName(string lastName)
{
using (SQLiteConnection conn = new SQLiteConnection(CONNECTIONSTRING))
{
SQLiteCommand comm = conn.CreateCommand();
cmd.CommandText = @"SELECT firstname, lastname, something, somethingElse FROM customer WHERE lastname = @setName";
cmd.Parameters.AddWithValue("@setName", txt_name.Text);
SQLiteDataAdapter adpat = new SQLiteDataAdapter(cmd);
DataTable tableResult = new DataTable();
adapt.Fill(tableResult);
return tableResult;
}
} But, even though this is an improvement, it still falls way short of production quality code.
modified 25-Mar-21 9:20am.
|
|
|
|
|
Adrian Rowlands wrote:
da_Customer = new SQLiteDataAdapter(cmd.CommandText, conn); Because you're passing the command text to the data adapter, not the command. The data adapter will create a new command using that command text, and none of the parameters you've added to cmd will be copied across.
Pass in the command object instead:
da_Customer = new SQLiteDataAdapter(cmd); But pay attention to Dave's advice (above[^]) as well.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In my opinion, this could probably have a lot to do with the software you are currently using.
|
|
|
|
|
Message Removed
modified 21-Apr-21 16:03pm.
|
|
|
|
|
Message Removed
modified 21-Apr-21 16:03pm.
|
|
|
|
|
Hello.
I'm new in programming with asp.net core,
and would like to know how to Create an Invoice page?
What has already been created:
a) Model/Bill.class && Row.class
b) Pages/Bill/Create, Update, Delete pages
c) Pages/Rows/Create, Update, Delete pages
d) Data/InvoiceDbContext
e) startup database connection
I Would like to create a Bill and then add some rows to it.
How can i add rows to a bill?
Can somebody help me?
Thank you.
|
|
|
|
|
Member 14566520 wrote: I Would like to create a Bill and then add some rows to it. Add those rows in the database.
We don't know what your classes do, or don't. Assuming you read from a database as would be logical, and the classes load from there, then that's where you add new data.
Why did you start working on "what already been created", if this question is unanswered? How many manhours spent on those classes, whithout answering this one first?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have a question about using VS to build a VSTO solution for Excel:
I built an Excel template for the company I work for and a significant portion of it relies on macros (for example, one of the functions is to use the drawing tools to automatically draw a picture of the product being manufactured and calculate weight of material required, calculate angles, size of mold, etc., and another copies the folder structure with material take-off, fabrication instructions, etc., and renames it match the sales order). Every project we do is a custom project so I'm constantly finding new requirements that didn't exist at the time I originally built the template. Sometimes the new requirements expose an error in my programming that I wouldn't have found otherwise. When this happens I not only have to change the template, but all project files created with the template - we have on average 130+ active projects at any given time and each project could have 1 or more product profiles (the largest I've had is 204). Needless to say, a minor change becomes a major undertaking.
I'm thinking about maybe revamping the whole thing as a VSTO project in VS but I'm not sure if it's really the best answer. The template resides on a shared network folder so anyone who needs access to it can do so. If I build the project as an VSTO Excel document, will it retain the code necessary to perform the core functions after the file is saved? (It's not uncommon for customers to make a change to the initial design, or add new profiles midstream so the ability to continue editing after the initial save is essential.) Will users need to install anything locally? Same question if I go the Excel Addin route. Which option would be best suited to the need? If I go either route, will a change in the code promulgate to the documents using the template or addin or I am looking at an exercise in futility when it comes to updating/correcting code?
Any thoughts, insights, tales of joyous success or dismal failure are welcome.
Thanks.
|
|
|
|